Repository navigation
executor: expanded '#' command words are commands, not comments - #3271
Merged
Merged
Conversation
A word whose expanded text starts with '#' was silently discarded with exit code 0 by execute_assignment_or_comment_command. GNU bash treats comments as purely lexical (parse.y:3630-3643): only a '#' that begins a word in the source text, at a position where a word can start, is discarded by the reader. A quoted or expansion-produced '#...' word is a command name and reports command-not-found (127). Source-text comments never reach the executor as words (the scanner consumes them), so the arm has no legitimate input; remove it. Verification on base e1afd25: pin stem issue3020 goes 3/9 -> 9/9; lib 1207 passed / 0 failed / 4 ignored; -D warnings clean at lib scope; fmt clean. Refs #3020 Refs #2683
caomengxuan666
marked this pull request as ready for review
November 10, 2026 16:30
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 #3020
Refs #2683
What changes
execute_assignment_or_comment_commandinsrc/executor/command_prepare.rscarried an arm that discarded any simple command whose first expanded word starts with#, reporting exit code 0. GNU bash treats comments as purely lexical (parse.y:3630-3643): the reader discards a#only when it begins a word in the source text where a word can start. Quoted, expansion-produced, command-substitution-produced and variable-carried#...words are command names and report command-not-found (127). Source-text comments never reach the executor as words because the scanner consumes them, so the arm had no legitimate input and is removed (4 lines).Note on the second issue
The same-line shopt/extglob pins were re-measured on the current master base
e1afd25dbefore any edit: all 10 pass. The earlier 2 red cells were healed by the read-unit entry snapshot work that landed for the neighbouring read-unit issue (PR #3223, commitf7fed212): its deferred extglob parking, the grouped feeder entry snapshot and the parse-loop marker arming cover the same grouped-driver mechanism. This PR therefore carries no product change for that side; the re-measurement is recorded here and in the lane report as evidence for the captain's decision.Verification (base
e1afd25d, per-stem result lines)RUSTFLAGS="-D warnings"check: clean at lib scope. The wider all-targets check is red on base and head alike from pre-existing warnings in unrelated test files (the export-function-render stem and the this-sh declare-listing stem); untouched by this change and left for their owners.cargo fmt --check: clean. Marker-literal lint: OK.本 PR 删除了什么
Removed the 4-line executor arm described above (one
ifblock insrc/executor/command_prepare.rs). Nothing else is deleted; no test files change (the pins are already on master via PR #3163).