Repository navigation
WIP: fix(lexer): deblank flag for fd-prefixed <<- heredocs (#2265) - #2269
Merged
Merged
Conversation
heredoc_delimiters decided strip_tabs by exact equality with
"<<-", but the numbered form's HereDoc token carries the whole
slice ("3<<-", number_redirect.rs), so every fd-prefixed <<-
lost deblank at gather time: body lines kept their tabs and a
tab-indented terminator never matched, swallowing the rest of
the input into the body. GNU parse.y:643-661 yields
r_deblank_reading_until for all three <<- forms (bare, NUMBER,
REDIR_WORD) and make_cmd.c:527 derives kill_leading from the
instruction alone. The parser-side flag already used
ends_with("<<-"); align the lexer decision with it.
Root cause of the six git t0000 test-lib self-check divergences
(#7/#34/#35/#36/#37/#40): all use check_sub_test_lib_test_err
with <<-EOF_OUT 3<<-EOF_ERR on a function call, so the fd-3
expected-stderr stream was the raw input remainder while the
sub-scripts' own output matched GNU byte-for-byte.
Refs #2265
caomengxuan666
marked this pull request as ready for review
October 30, 2026 17:57
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP: #2265 修复——编号 fd 的
<<-heredoc 在 lexer 收集层丢失 deblank。根因:
3<<-EOF的 HereDoc token value 是整段切片3<<-(number_redirect.rs 合并 token),而heredoc_delimiters用value == "<<-"判 strip_tabs,编号形恒假。正文 tab 不剥、带 tab 的终止行永不匹配,body 吞到输入结尾(后续命令行一并被吞),同命令其余 heredoc 连带中毒。t0000 六条失败(#7/#34/#35/#36/#37/#40)全是此根:它们都用check_sub_test_lib_test_err的<<-EOF_OUT 3<<-EOF_ERR函数调用形,坏的是 fd-3 生成的 expect.err,子脚本自身 out/err 与 GNU 逐字一致(验收 trash 工件已核)。规格:parse.y:643-661 三种
<<-文法形同产 r_deblank_reading_until;make_cmd.c:527 kill_leading 只看 instruction。parser 侧标志(ends_with)一直正确,本单对齐 lexer 侧(一行 + 注释)。钉:tests/issue2265_numbered_fd_dash_heredoc_regressions.rs 11 枚,期望按 GNU 5.3.20 探针字节写定(探针账与定性全文在簇 REPORT)。
配给制分栏:本地仅 cargo check(lib + 新钉目标,exit 0)+ rustfmt + CR 核;钉实跑与 t0000 验收复跑归主会话批量。
另有一条独立发现(外部命令不装编号 fd heredoc body,探针 p4 系列)记在簇 REPORT,未在本单处理。
Refs #2265