Skip to content

test(expansion): pin same-word assign-order regressions (Refs #3027) - #3082

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix/3027-in-word-assign-order
Nov 8, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix/3027-in-word-assign-order

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Refs #3027

内容(合入前口径订正)

本 PR 原含两部分:expand_word.rs 的整词门改动(braced_parameter_spans_whole_word 门控 SubSiteGuard)+ 11 格回归钉。与 master a5168736(#3077,#3045)合并时发现真冲突,队长手工解:#3077 的整词臂重构已把整臂包进同一整词门内,本 PR 的门改动被完全 subsume——解后 expand_word.rs 与 master 逐字相同。

本 PR 对 master 的净差异只剩回归钉文件 tests/issue3027_in_word_assign_order_regressions.rs(+146,11 格)。代码修复本体已随 #3077 落地,本 PR 落钉坐实。

验证(队长复核,全量日志在案)

  • 钉 @ 头:11 passed / 0 failed
  • fail-first(钉移植真基底):4 passed / 7 failed,失败名集恰为 7 个泄漏格
  • lib 头/基底双边 1198/0/4;邻茎 10 茎 70/0;GNU 探针 7 形全 SAME
  • RUSTFLAGS="-D warnings" / fmt / hygiene / CR 全净
  • 合并树双钉复验:issue3027 11/0 + issue3045 24/0(合并提交 fc92629a 树上亲跑)

本 PR 删除了什么

无删除。对 master 的净 diff 仅新增钉文件一行未删;原 expand_word.rs 改动在冲突解决中被 #3077 的等价重构吸收,未带入任何回退。

…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
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
@caomengxuan666 caomengxuan666 changed the title fix: gate expand_word site guard on whole-word braced span (Refs #3027) test(expansion): pin same-word assign-order regressions (Refs #3027) Nov 8, 2026
@caomengxuan666
caomengxuan666 merged commit da202cd into master Nov 8, 2026
11 checks passed
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