Skip to content

[bug] Unquoted compound-assignment fan-out does not glob: arr=(${a[@]}) and declare -a d=($x) keep literals (GNU stores matches) #377

Closed

Description

@caomengxuan666

Found by the wt24/regfix lane while fixing #369 (pre-existing at the good commit 8f89767, opposite direction from #369, separate arms — out of that lane's scope).

Shapes (WSL GNU Bash 5.3.0 script-file oracle)

a=('*' '*')
arr=(${a[@]})        # GNU: globbed matches stored; rubash: literal '*' entries
x='*'; declare -a d=($x)   # GNU: globbed; rubash: literal

#369's fix made the QUOTED class correct (arr=("$x") stays literal, byte-verified) and the plain unquoted single-parameter case still globs (arr2=($y) verified green), but the at-list fan-out (${a[@]}) and the declare -a d=($x) arm do not pathname-expand their unquoted fields.

GNU spec pointer

Same chain as #369 minus the quoting: arrayfunc.c:557 expand_compound_array_assignment -> :605 expand_words_no_vars -> subst.c:12590 expand_word_list_internal -> :12602 glob_expand_word_list. Unquoted ${a[@]} fields carry no CTLESC protection (subst.c:11229 expand_word_internal unquoted branch), so each field is glob-eligible.

Note

The #369 matrix (m369.sh in the lane artifacts) carries the two failing shapes as its remaining diffs; whoever picks this up should extend tests/issue369_quoted_compound_element_glob_regressions.rs (or a sibling file) with the unquoted fan-out class and re-run the matrix.

Activity

  1. added 2 commits that reference this issue on Oct 1, 2026
  2. caomengxuan666 commented on Oct 1, 2026

    @caomengxuan666
    MemberAuthor

    Landed as a8eb9e9 (wt29/rubugs lane 3e6f9197). One transport invariant across three sites: the ARRAY_FIELD_SPLIT_MARKER stays reserved for unquoted field-split products (glob per field, GNU subst.c:13264 via expand_words_no_vars arrayfunc.c:610), and declare-side quoted products keep their serialized CTLESC pairs so the storage glob gate stays protected (pathexp.c:120-122). 30+ shape matrix byte-identical to WSL GNU 5.3.0; issue377 suite 12/12. CI green.

  3. caomengxuan666 commented on Oct 17, 2026

    @caomengxuan666
    MemberAuthor

    Root cause found and fixed as PR #699 (branch fix/issue377-declare-quoted-glob): the NoMatch arm pushed dequoted text, the consumer globbed it. Now quoting state serializes inside the quotes (CTLESC); = arm dequotes left for subscript parse. File 10/12->11/12; glob 34/34. Gate running.

  4. caomengxuan666 commented on Oct 17, 2026

    @caomengxuan666
    MemberAuthor

    Correction: the fix PR is #730, not #699.

  5. caomengxuan666 commented on Oct 17, 2026

    @caomengxuan666
    MemberAuthor

    Follow-up fixed and landed as #730 (squash-merged 365472c): quoted compound elements keep quoting state through the marker transport (CTLESC inside quotes); = arm dequotes left for subscript parse. The quoted--loses-quoting divergence is gone (file 10/12->11/12; rest pre-existing). Gates identical (niu 8=8).

  6. added a commit that references this issue on Oct 17, 2026
  7. added
    bug
    area:expansion
    family:S2
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:expansionbugfamily:S2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions