Repository navigation
fix(executor): keep quoted whole-word default expansions one compound element - #466
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #432
Problem
a=("${v:=x y}")stored two elements (x,y) where GNU stores ONE elementx y(same for${v:-x y}; plain("$v")was fine). wt66-adjacent compound-array quoted-expansion family.Root cause
whole_word_parameter_single_value(the whole-word${...}fast path for compound array elements) only claimed plain names and array references. A whole-word${name:=word}/${name:-word}/${name=word}/${name-word}/${name:?word}token therefore fell through to the embedded-parameter walker, whose re-quoted splitter treats expansion output whitespace as live IFS data — the default word's space split the quoted element into two.Fix
Claim the word-producing operator family in
whole_word_parameter_single_valuewith ONEexpand_wordpass (the same${}re-expansion the embedded walker performs, so the:=side effect still runs exactly once). Through this helper the compound splitter sees the token as a whole-word parameter and a wholly double-quoted token keeps GNU's W_QUOTED no-split semantics (subst.c:12050): one elementx y.a=(${v:=x y})stores 2 elements and still assignsv=x y.+/:+alternates keep their dedicated fanout path (rubash#315); at-list ([@]/[*]), indirect (!) and length (#) bodies stay out of the new arm.declare -a a=("${v:=x y}")and the[sub]="${v:=x y}"element form pick up the same gluing (W_NOSPLIT).Tests
New suite
tests/issue432_compound_quoted_default_regressions.rs(13 tests): the issue repro, no-space default,:-/=/:?family (set + unset + error paths), unquoted field-split, set-variable non-use, declare/subscript/scalar non-compound guards, IFS insensitivity, and the rubash#315+guard idioms.Related suites (
array_compound_quote_regressions,issue148,issue298_299,issue369,issue391,--lib) green. Fullcargo test --tests --no-fail-fastfailure set compared byte-for-byte against the unmodified branch tip: identical (all pre-existing environment failures on this Windows box, incl. the pre-existingguard_147_idioms_stay_greenfailure that also fails on baseline); no regressions.