Repository navigation
test(expansion): pin same-word assign-order regressions (Refs #3027) - #3082
Merged
Merged
Conversation
…ubash#3027)
11 cells: repro (${a:+b}${a=b} in unquoted arg and as command word),
t0238 three-expansion concatenation, := / :- / bare-+ variants,
reversed order, split words, assign-binds-for-later-reads, and
subscript side-effect dedup. Fail-first on base 86ed8dd: 4 passed /
7 failed, the 7 failures exactly the leak cells.
expand_word installed SubSiteGuard::new(0) for any word starting with
${ and ending with }, including multi-fragment words such as
${a:+b}${a=b} (stripped to the bogus name 'a:+b}${a=b'). The guard
stayed alive while expand_braced_parameter_word declined the word to
the embedded walker, so walker fragments keyed one level deeper
([0, frag]) than the pre-scan's freeze ([frag]); the rubash#1169
freeze was never found and the ${a=b} bind leaked backwards into
${a:+b}. Only a word that really is one ${...} fragment may claim
site 0 here - the same spans-whole-word gate the mutable whole-word
entry already applies before its own guard.
GNU: subst.c:11229 expand_word_internal walks fragments in order;
subst.c:9777 parameter_brace_expand binds '=' inside
parameter_brace_expand_rhs (subst.c:8096-8151) at the moment the
fragment is reached.
Refs #3027
caomengxuan666
marked this pull request as ready for review
November 8, 2026 05:37
…3027-in-word-assign-order # Conflicts: # src/executor/expand_word.rs
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 #3027
内容(合入前口径订正)
本 PR 原含两部分:
expand_word.rs的整词门改动(braced_parameter_spans_whole_word门控SubSiteGuard)+ 11 格回归钉。与 mastera5168736(#3077,#3045)合并时发现真冲突,队长手工解:#3077 的整词臂重构已把整臂包进同一整词门内,本 PR 的门改动被完全 subsume——解后expand_word.rs与 master 逐字相同。本 PR 对 master 的净差异只剩回归钉文件
tests/issue3027_in_word_assign_order_regressions.rs(+146,11 格)。代码修复本体已随 #3077 落地,本 PR 落钉坐实。验证(队长复核,全量日志在案)
RUSTFLAGS="-D warnings"/ fmt / hygiene / CR 全净fc92629a树上亲跑)本 PR 删除了什么
无删除。对 master 的净 diff 仅新增钉文件一行未删;原
expand_word.rs改动在冲突解决中被 #3077 的等价重构吸收,未带入任何回退。