testsuite batch90: unquoted ${a[@]OP} drops elements the operator makes empty - #298
Merged
Conversation
An unquoted ${a[@]} whose per-element operator (##/%%/pattern
substitution/etc.) reduces an element to the empty string must produce
no word for that element -- it splits away -- just as a plain unquoted
${a[@]} empty element does. gnash's per-element OP path instead emitted
an unconditional FIELD_SEP boundary, inserting a spurious empty field
(a double space in the joined output).
Restructure the OP path to mirror the proven plain-array path: the
quoted "@" case keeps empty elements (QNULL), unquoted "*" joins with
the first IFS char (splittable), and unquoted "@" skips empty elements.
array.tests line 204 `${xpath[@]%%[!/]*}` and the assoc/exp analogues
now match bash.
Closes #297
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.
Summary
An unquoted
${a[@]OP}expansion (per-element operator:##/%%/pattern substitution/etc.) that reduces an element to empty must drop that element — it splits away — like a plain unquoted${a[@]}empty element (batch49). gnash instead emitted a spurious empty field.Fix
Restructured the per-element OP path in
expand.cppto mirror the proven plain-array path:"@": keep empty elements (QNULL)*: join with first IFS char (splittable)@: skip empty elementsScoreboard
array221 → 209 (−12)assoc94 → 88 (−6)exp46 → 44 (−2 bonus)Verification
Closes #297