You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] assignment y="($x)" leaks 0x10 + quotes into the stored value #3034
area:expansionword splitting, quote removal, parameter/brace expansionbugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
An assignment whose right-hand side contains ( + an expansion + ) leaks a 0x10 carrier byte plus a pair of " into the stored value. The same expansion in command-argument position decodes correctly — only the assignment path leaks.
Repro
x=v1.0; y="($x)";printf'%s'"$y"| od -An -tx1
GNU bash 5.3.20: 28 76 31 2e 30 29 ((v1.0)).
rubash master 6eb861b8: 28 10 22 76 31 2e 30 22 29 ((\x10"v1.0")).
Controls
Argument position is clean: printf '%s' "($x)" → (v1.0) on both shells.
y="$x", y="[$x]", y="x$x" are clean on both shells.
Also leaks: y="(${x})", y='('$x')' (single-quoted parens + unquoted expansion).
This is the root of #3005's __git_ps1 detached-HEAD symptom: git-prompt.sh's detached branch does b="$(git describe …)" and then b="($b)" — the second step is exactly this shape. #3005's body claims the root is in command-substitution-capture decoding; that claim is disproven by captain probe on master:
b="$(echo v1.0)" alone: clean on rubash (76 31 2e 30).
When this fix lands and is verified (regression pin + __git_ps1 detached chain re-run), #3005 should close with it. #3005 stays open until then.
Fix surface (suspected)
src/executor/assignment_expansion.rs — assignment-path marker decode gap (same file #3016 is repairing; this issue queues behind #3016). Regression pin: y="($x)" byte assertion + __git_ps1 detached ((v1.0)).
Source
eco-2907 REPORT F1 (git contrib chain, master 6eb861b8, GNU 5.3.20 oracle; captain reproduced F1 + all controls + the #3005 disproof probes on master).
RUSTFLAGS="-D warnings" rc=0; hygiene clean; fmt clean; CR zero. CI on the merged head: 10 green + 1 skipping, CLEAN.
Root cause: the compound-expansion functions were called on any paren-shaped value without the parser's compound判定, so y="($x)" was claimed as an element list and its transport product stored raw. The fix gates all three call sites on COMPOUND_ASSIGNMENT_MARKER.
area:expansionword splitting, quote removal, parameter/brace expansionbugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
Activity
fix(expansion): only run compound expansion on parser-marked compound…
caomengxuan666 commentedon Nov 8, 2026
Closed by merged PR #3056 (squash merge
873b30e6, 2026-11-08).Captain verification (head
fd6e13e5, true base30ddc122; full record in the captain review):__git_ps1chain shape.RUSTFLAGS="-D warnings"rc=0; hygiene clean; fmt clean; CR zero. CI on the merged head: 10 green + 1 skipping, CLEAN.Root cause: the compound-expansion functions were called on any paren-shaped value without the parser's compound判定, so
y="($x)"was claimed as an element list and its transport product stored raw. The fix gates all three call sites onCOMPOUND_ASSIGNMENT_MARKER.test(eco): real git-contrib chain pin + mvdan-n re-check (Refs #2907) (…