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
Compound array element loses backslashes when a $var expansion adjoins quotes: Y=($X'⚡') and declare -a V=([0]=$X'Q') #295
Two deeper members of the double-quote-removal family that #288's lane declared out of scope (honest leftovers; no regression — behavior identical before 847ab88):
`Y=($X'⚡')` — initial compound assignment where an expanded variable is adjoined by a quoted suffix. Backslashes now survive (Initial compound array assignment loses backslashes in single-quoted elements (A=([0]='\[\e[33m\]Z') stores [e[33m]Z) #288), but the quote DELIMITERS of the suffix leak into the element as data: GNU stores `[\e[33m]⚡`, we store the value with literal `'⚡'` quoting. Located at the element fast path in src/executor/assignment_expansion.rs (`compound_plain_element_value_fields` field-split arm -> `store!` wraps as `"..."`, turning quotes into data).
`declare -a V=([0]=$X'Q')` — still loses backslashes (the whole-token double-quoted form `[0]="$X"Q"" is already correct). Instrumented to expand_compound_assignment_rhs: the `\e` is already eaten upstream in the non-mut preserve walker's parameter-output layer (bare concatenation + CTLESC tagging). The GNU-shaped fix is a protection carrier equivalent to add_quoted_string (subst.c:11862) at the expansion output point, decoded at the declare storage boundary — an independent deep-water change.
Repro family (od -c probes, WSL GNU Bash 5.3.0 as oracle) available from the wt9/arrayesc artifacts recorded in #288.
Fixed by wt12/deepvar (870d03d4, master 116b12a): both deep-water members of the family.
(1) Y=(dollar-X quoted-thunder) quote-delimiter leak: the hoist promotes the quoted suffix to the E307 carrier, and compound_plain_element_value_fields emitted the final storage token BEFORE the hoist restore - the outer restore then decoded E307 back into apostrophes inside the wrapping, turning delimiters into data. GNU does this quote removal INSIDE expand_word_internal (parse.y:5419-5436 parse_matched_pair + subst.c:11881 quote case). Fix: span-aware re-split + re-serialization of requoted hoisted words per subst.c:12177 set_word_flags (only WHOLLY quoted spans are split-exempt; quoted spans re-wrap as data; expanded/bare text stays globbable - issue148 regression held).
(2) declare -a V=([0]=dollar-X quoted-Q) backslash loss: the lexer-expanded backslashes arrived as bare text at expand_compound_assignment_rhs and were eaten as source escapes by re-tokenization. GNU protects expansion output via subst.c:12890 -> arrayfunc.c:979 quote_compound_array_word (and add_quoted_string/quote_string). Fix: carrier family E30D (backslash, per #218)/E30A/E30B/E30E/E30F on the non-mut preserve walker parameter and comsub output points, decoded AFTER each storage boundary unescape - same shape as #218 mut walker.
Plus five same-family adjacent roots the 32-form matrix exposed (assoc kvpair mode detection made quote-aware, indexed tag stripped on the assoc channel, kvpair words via dequote_compound_element_rhs, transport-only PARAM_NAME_END_MARKER reclaimed, StorageWordIter treats E307/E302 as quote toggles). All adjacent regression batteries green (298_299/301_303/302_304/296 golden/148); 83-suite spot quote/comsub/dstack 0 diff; full cargo test failures identical to pristine base.
Activity
fix(#295): expansion-result protection carriers for compound array el…
caomengxuan666 commentedon Sep 29, 2026
Fixed by wt12/deepvar (870d03d4, master 116b12a): both deep-water members of the family.
(1) Y=(dollar-X quoted-thunder) quote-delimiter leak: the hoist promotes the quoted suffix to the E307 carrier, and compound_plain_element_value_fields emitted the final storage token BEFORE the hoist restore - the outer restore then decoded E307 back into apostrophes inside the wrapping, turning delimiters into data. GNU does this quote removal INSIDE expand_word_internal (parse.y:5419-5436 parse_matched_pair + subst.c:11881 quote case). Fix: span-aware re-split + re-serialization of requoted hoisted words per subst.c:12177 set_word_flags (only WHOLLY quoted spans are split-exempt; quoted spans re-wrap as data; expanded/bare text stays globbable - issue148 regression held).
(2) declare -a V=([0]=dollar-X quoted-Q) backslash loss: the lexer-expanded backslashes arrived as bare text at expand_compound_assignment_rhs and were eaten as source escapes by re-tokenization. GNU protects expansion output via subst.c:12890 -> arrayfunc.c:979 quote_compound_array_word (and add_quoted_string/quote_string). Fix: carrier family E30D (backslash, per #218)/E30A/E30B/E30E/E30F on the non-mut preserve walker parameter and comsub output points, decoded AFTER each storage boundary unescape - same shape as #218 mut walker.
Plus five same-family adjacent roots the 32-form matrix exposed (assoc kvpair mode detection made quote-aware, indexed tag stripped on the assoc channel, kvpair words via dequote_compound_element_rhs, transport-only PARAM_NAME_END_MARKER reclaimed, StorageWordIter treats E307/E302 as quote toggles). All adjacent regression batteries green (298_299/301_303/302_304/296 golden/148); 83-suite spot quote/comsub/dstack 0 diff; full cargo test failures identical to pristine base.