Skip to content

fix(executor): dequote for-list bindings so loop vars glob (#675) - #683

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/issue675-casearm-loopvar
Oct 16, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/issue675-casearm-loopvar

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

fix(executor): dequote for-list bindings (loop-var glob loss) (#675)

What

for p in "f*"; do case foobar in $p) missed in rubash (MISS:f*)
but hits in GNU (HIT:f*). Deeper than the case arm: ${#p} was 3
vs GNU 2, and unquoted $p never globbed anywhere — the loop variable
bound f+CTLESC+* instead of plain f*. Only the double-quoted
for-list path skipped dequote (single-quoted, assignment, and argv
paths all dequote).

Fix (wrong invariant, no new guard)

finalize_for_list_value (storage-side half of GNU dequote_string,
subst.c:4807 via dequote_ctlesc_pairs, markers.rs:752) applied
at all four for-list bind sites in expand_for_brace_word_values.
GNU dequotes every bound word once splitting/globbing have decided,
quoted or not; the #662 fast-path classifier is untouched (it already
routes $... to the slow path).

Verification

  • Repro + glob probes byte-identical to GNU (HIT:f*, <foobar>,
    len=2).
  • casearm_diff.sh 29/30 → 30/30; ifcase_diff.sh 55/55.
  • New issue675_casearm_loopvar_regressions (3 tests).
  • cargo test --lib 594/594; for-list glob, quoted-element, case,
    arith-for, quote-roundtrip, extglob suites green.
  • Full serial failure-set gate vs master: per-target results match
    except the new regression file itself (3/3). Test-level 2 NEW / 1
    DISAPPEARED, all three in the known-nondeterministic part_080
    coproc family (all pass in isolation on branch). No regression.
  • niubash product A/B (niubash pinned 6295367, only rubash [patch]
    switched): failure sets byte-identical (49=49).

for p in "f*" bound f+CTLESC+* (len 3, glob-dead) instead of plain
f* (GNU dequote_string, subst.c:4807, dequotes every bound word once
splitting/globbing decided). finalize_for_list_value at all four
for-list bind sites in expand_for_brace_word_values. #662 classifier
untouched.

casearm 29/30 -> 30/30, ifcase 55/55. 3 new tests.
@caomengxuan666
caomengxuan666 merged commit ebb2bb5 into master Oct 16, 2026
8 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/issue675-casearm-loopvar branch October 16, 2026 16:40
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