Repository navigation
fix(executor): vanished-words null command expands numbered-fd heredoc bodies in the shell (Refs #2761) - #3842
Merged
Conversation
…c bodies in the shell (Refs #2761) 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.
Member
Author
|
【WIN-AGENT-AUDIT】 机制核查:
腿(逐项给数字与名字):
F 点:无。 续作记录:无(纯审核,未动代码)。 未跑/VOID 的腿:无。 备注:PR 正文「Verification (owed)」自承本机无 cargo 腿——本轮已补齐上述全部腿。正文有关单词扫描: |
Member
Author
|
【WIN-AGENT-BATCH-SUMMARY】
未触碰:禁碰清单 12 个 PR、队长专属 open PR 均未动;未合入/未关单/未 approve;未 force-push;未改 continuation.rs。 |
caomengxuan666
marked this pull request as ready for review
November 17, 2026 10:52
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.
Refs #2761 — absorbs the surviving remainder of Uarz #3362 after #3715 merged (487c745).
What survives from #3362
One product hunk,
src/executor/command_execute.rs:548(vanished-words arm): clonecmd, clearwords, and hand the wordless node toexecute_empty_words_command. GNU's words==0 check (execute_cmd.c:4626-4640) runs on the EXPANDED word list, which is empty here — the node is a null command, and the force-fork rule (execute_cmd.c:4210-4216: fd-0 / REDIR_VARASSIGN only) leaves a numbered-fd body expanding in the shell, so:=persists. Before this hunk the classifier saw the raw["$EMPTY"]word, forked the expansion, and$EMPTY 3<<EOFwith${v:=bound}lost the binding.What was dropped (already in master via #3715)
abort_on_expansion_errors,preexpand_command_stdin→pub(in crate::executor)).command_prepare.rsinsertion block — superseded by fix(heredoc): expand heredoc bodies on wordless null commands (Refs #2761) #3715's 61-line version with the funsub-exit latches.preexpand_command_stdinkeeps master'sOption<i32>return (the executor: heredoc-body funsub exit latch lingers into the next command #2763 latch); fix(executor): expand heredoc bodies on raw-empty null commands #3362's()signature was NOT taken.Pins
tests/issue2761_heredoc_null_command_expansion.rs, 9 cells — the shapes #3715 lacks: the discriminatingvanished_words_numbered_heredoc_assign_persists(red on master by code trace, green after this hunk) plus eight coverage pins (arithmetic ×2, two-heredoc order ×2, arith-error ×2, fd0-fatal ×1, post-alias ×1). The other 8 of #3362's 17 pins duplicate #3715's and were dropped. The rest of #2761's face is pinned by #3715'stests/issue2761_heredoc_empty_words_regressions.rs.Guard scan
Open PRs touching
command_execute.rs/command_prepare.rs: only #3755 (touchescommand_prepare.rsonly, hunks at 2648–6572 — this PR does not touch that file) and #3362 itself (the source). No hunk within 1000 lines of this PR's hunk. Clear to proceed.Verification (owed)
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 (full trace in
REPORT.mdat the workdir; comparison report~/workspace/fix-uarz-compare/REPORT.md§2). CI census (which runs all stems) adjudicates on this PR: expect the discriminating pin green here, and the 8 coverage pins green throughout.本 PR 删除了什么
无。新增一个 product hunk + 9 个回归钉。从 #3362 原案中略去的 hunks 本就未合入,不构成对 master 的删除。作者:Uarz(原 #3362 作者,本次吸收保留其作者身份);吸收与裁剪由本次车道执行。