Repository navigation
Conversation
Raw-empty null commands routed through execute_empty_words_command and bypassed the stdin pre-expansion funnel, so heredoc and here-string bodies were never expanded. Route them through the existing preexpand_command_stdin funnel before the reject gate, mirroring the worded path ordering. Refs unixwin#2761 Regression pin: tests/issue2761_heredoc_null_command_expansion.rs (18 tests; fail-first 10 failed on the unpatched tree, 18/18 pass after). Adjacent families green. GNU 5.3.20 oracle probes P1-P15, P17, P18 byte-identical. Owed: P16 divergence ($EMPTY 3<<EOF fatal body error not fatal in the main shell) is pre-existing and left for a separate issue.
|
[WIN-AGENT-AUDIT] PR #3362 第1轮 — 建议:PENDING(缺腿/队长裁定) 机制核查:本 lane 未重审 diff——issue #2761 最后一条评论(2026-11-14)明示「队长车道临时接手(Uarz 休息期间),已开工修法」,且 #3362 与 #3715 为同一 issue 的竞争实现。按既定裁定,本 issue 不并行推进,本 PR 维持 hold。 腿:未跑(hold 期间不消耗验证资源)。 F 点:无(非 FAIL 判定)。 未跑/VOID 的腿:全部——原因:队长已接管 issue #2761,本 lane 按 hold 处理;若队长裁定 #3362 胜出或需对比,再补全腿。 |
|
【WIN-AGENT-AUDIT】 只读机制对比(对 master ccb8614 逐 hunk 核):
GNU 依据(复核):execute_cmd.c:4626-4640 expanded-words==0 → execute_null_command;execute_cmd.c:4203-4278 force-fork 规则(fd-0/REDIR_VARASSIGN → fork);redir.c:423-434 heredoc_expand;与 #3842 审计同源。 F 点:无(非缺陷判定;系被取代判定)。 未跑/VOID 的腿:全腿未跑——只读评估 + head 未变 + 队长已接管 issue,按规程不并行续作;机制吸收结论以 master 源码逐 hunk 比对为准,未在 #3362 head 上重跑钉(其钉与 #3842 钉同族,#3842 侧已核 9/9)。 |
…c bodies in the shell (Refs #2761) (#3842) The vanished-words arm of the empty-words dispatch passed `cmd` with its raw words (`["$EMPTY"]`) to `execute_empty_words_command`, so the heredoc fork classifier saw an effective word and expanded a numbered-fd body in a fork, discarding `:=`. GNU's words==0 check runs on the EXPANDED word list, which is empty here — the node is a null command, and the force-fork rule (fd-0 / REDIR_VARASSIGN only) leaves a numbered-fd body expanding in the shell, so `:=` persists. Hand the node to the null-command path wordless, as GNU sees it. GNU anchors (audit tree bash-5.3, verified): - execute_cmd.c:4626-4640 — `words == 0` dispatches to execute_null_command. - execute_cmd.c:4210-4216 — force-fork only for REDIR_VARASSIGN or a redirect targeting fd 0 / bash input; fd-3 does not force it. Absorb note: this is the surviving remainder of Uarz #3362 after #3715 merged (487c745). Dropped as already-in-master: both visibility changes (`abort_on_expansion_errors`, `preexpand_command_stdin`) and the `command_prepare.rs` insertion block (superseded by #3715's 61-line version with the funsub-exit latches). `preexpand_command_stdin` keeps master's `Option<i32>` return (the #2763 latch); #3362's `()` signature was NOT taken. Pins trimmed from 17 to the 9 shapes #3715 lacks: the discriminating `vanished_words_numbered_heredoc_assign_persists` (red on master by code trace, green after this hunk) plus eight coverage pins (arithmetic x2, two-heredoc order x2, arith-error x2, fd0-fatal x1, post-alias x1). Verification: no cargo/rustc on this VM and the X299/server routes are down, so no local leg ran. Pin red/green is established by code trace (see REPORT.md); CI census (which runs all stems) adjudicates on the PR. Co-authored-by: Uarz <[email protected]>
Fixes #2761
What was fixed
Heredoc bodies on raw-empty null commands were never expanded: the empty-words dispatch went through
execute_empty_words_command, which bypassed the stdin pre-expansion funnel entirely, so no stdin consumer ever materialised the body.The fix routes empty-words commands through the existing
preexpand_command_stdinfunnel (after the assignment loop, before the reject gate), mirroring the worded path's ordering. All three empty-words arms (raw-empty, vanished-words, post-alias) share this function, so one insertion covers them.What was deleted
Nothing. No files, features, or tests were removed.
Verification (all run, per-item counts)
tests/issue2761_heredoc_null_command_expansion.rs: 18/18 pass. Fail-first on the unpatched tree: 4 passed / 10 failed (all expansion cases failed).heredoc_regressions3/3,issue26769/9,issue268129/29, null-command / assignment / redirect families ([redirection] redirect 词缺 set -u 检查:<<< $nope 静默空展开(GNU 报 unbound variable 继续);< $nope 误报 ambiguous redirect (P1) #535, [bug] readonly assignment in function body /{ }group does not abandon rest of line (GNU aborts the list) #1318, executor: assignment-RHS output procsub v=>(...) is finalized late and twice (diagnostic on the next line ×2, following $? polluted) #1523, [bug] ${v:=x} 对 readonly 赋值失败退出状态 2 应为 1 #1542, [bug] Plain-path null command from comsub does not fire the ERR trap (timed form fixed in #1611) #1661, -c seeded BASH_SOURCE accepts := assignment; GNU fatals on att_noassign #2369, [B2-F06] Redirect-only commands expand redirect words before binding their (permanent) assignments #2718, [bug] Special variable $_ is never updated by command execution (: "ARG"; echo $_ keeps startup value) — pure-bash-bible trim_string/urlencode corrupt #321) 79/79.third_party/bash): probes P1–P15, P17, P18 byte-identical with the fixed binary.cargo build -j 2clean,cargo fmtclean.src/lexer/continuation.rsuntouched.Owed
P16 divergence (pre-existing, not introduced here):
$EMPTY 3<<EOF ${UNDEF:?boom} EOF— GNU exits the script (fatal in the main shell), rubash printsaliveand continues. The root is the heredoc-error pre-check classifying by the original words; fixing it touches the #2681 error-adjudication layer and is left for a separate issue.