Skip to content

compound-assignment spaced elements are not glob-expanded (arr=([ empty ] =) keeps bracket words literal; GNU expands) #391

Closed

Description

@caomengxuan666

Found during wt33 triage of #373 (C04 probe). Real semantic gap in compound-assignment element handling.

Repro (script file, both shells; scratch cwd contains a file named e)

target/issue-suites/results/wt33-373/cases/C04_compound_elements_behavior.sh line 5:

arr=([ "a]=b" ] = value [ empty ] =)
printf '<%s>' "${arr[@]}"; echo

WSL GNU Bash 5.3.0 (cwd containing e):

<[ a]=b ]><=><value><e><=>

(i.e. [ empty ] is treated as a bracket-glob word and expands to the matching file e)

rubash:

<[><a]=b><]><=><value><[><empty><]><=>

(words stay literal, split on the spaces inside the parens)

Notes

  • The first four lines of C04 (indexed/subscript/quoted/single-quoted elements) are byte-identical between the shells except the ~/x element, where only the $HOME prefix differs (platform noise).
  • Raw artifacts: target/issue-suites/results/wt33-373/run/C04_compound_elements_behavior.{gnu,rub}.*.
  • The old test asserted a spaced-subscript structured parse that GNU never had; tests/parser_tests.rs now asserts the raw marker form and references this issue for the residual glob divergence.

Activity

  1. added
    bug
    on Oct 2, 2026
  2. added a commit that references this issue on Oct 2, 2026
  3. caomengxuan666 commented on Oct 2, 2026

    @caomengxuan666
    MemberAuthor

    Root cause located (wt37/gapfix1): parse.y:5634-5645 — under PST_COMPASSIGN an element-leading [ takes the P_ARRAYSUB matched-pair branch, swallowing quoted ] and the whole whitespace-containing word; without a trailing = the element becomes the paren-glob word. Fix belongs in the same element splitters #389 touched (workload ≈ one more #389). Next wave.

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

    @caomengxuan666
    MemberAuthor

    Landed (CI green d47cef6): the element-leading [ now follows parse.y:5635-5651's P_ARRAYSUB branch through all five splitter layers — quote-aware subscript detection (the old find(")=")/split_once('=') misjudged and silently dropped elements), whitespace inside the matched pair is data (5645-5647 strcpy), storage gate keeps the field intact; glob per subst.c:13205-13276 without field splitting. Reproducer byte-identical plus the a+=b/[1]+=2/quoted-operator families; 13/14 matrix (residual filed); issue391 suite 5/5; baselines unchanged.

  6. added a commit that references this issue on Oct 3, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions