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] $[...] containing the enclosing quote char inside double quotes prints literally instead of bad-substitution #2441
area:expansionword splitting, quote removal, parameter/brace expansionbugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
Found during PR #2420's finisher pass, verified by the main session against GNU bash 5.3.20 (master and the #2420 branch behave identically): a $[...] body containing the SAME quote character as the enclosing double quotes is not diagnosed; the whole expansion prints literally with rc 0.
Repro
echo"i=$["1]"]"
GNU: bash: bad substitution: no closing ']' in i=$[ — the command is discarded, rc 1, nothing on stdout.
rubash: prints i=$["1]], rc 0.
Root area
Different mechanism from #2374/#2375 (both fixed): inside double quotes, the $[...] span end-finder treats the inner " as closing the enclosing quote context instead of scanning for the ] under the arithmetic-span rules, so no span is ever extracted and no error is raised. GNU diagnoses the unterminated span at expansion time (subst.c bad-substitution path). Fix by mechanism in the span extraction/end-finding for quoted contexts, not by special-casing this shape.
Fix destination
Arithmetic-expansion family, later wave (post-1.5.0-gate, land-if-clean).
Regression seed: the repro above (GNU: stderr diagnostic + rc 1 + empty stdout), plus neighbors probed at fix time (echo "i=$['1']", unquoted echo $["1"]).
PR #2451 (merged, master d44dce1). Three-layer fix: dquote cookers bound spans by a skip_double_quoted port (subst.c:1014), the collector gains a segment-bounded mode, and walker arms raise the no-closing-bracket verdict on the DISCARD latch. My verification: issue2441 pins 6/6 green (scrubbed-fd harness).
area:expansionword splitting, quote removal, parameter/brace expansionbugSomething isn't workinggnu-baselineTracked by the GNU Bash 5.3.0 true-baseline ledger
Activity
Merge pull request #2451 from unixwin/fix/expansion-2441-2428-2417
caomengxuan666 commentedon Nov 1, 2026
PR #2451 (merged, master d44dce1). Three-layer fix: dquote cookers bound spans by a skip_double_quoted port (subst.c:1014), the collector gains a segment-bounded mode, and walker arms raise the no-closing-bracket verdict on the DISCARD latch. My verification: issue2441 pins 6/6 green (scrubbed-fd harness).
test(expansion): correct issue2227 controls pin to the GNU verdict fo…
fix(expansion): $[...] verdict names the double-quoted segment (rubas…