Skip to content

WIP: fix(lexer): deblank flag for fd-prefixed <<- heredocs (#2265) - #2269

Merged
caomengxuan666 merged 2 commits into
masterfrom
fix/2265-t0000-subtests
Oct 30, 2026
Merged

caomengxuan666 merged 2 commits into
masterfrom
fix/2265-t0000-subtests

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

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

caomengxuan666 and others added 2 commits October 30, 2026 17:31
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant