Skip to content

[bug] var=( "${arr[*]}" ) splits the quoted ${arr[*]} into N elements (GNU: 1 element) #194

Closed

Description

@caomengxuan666

Found by the suite2 ledger run (new-exp suite, new-exp4.sub Case02), WSL GNU Bash 5.3.0 baseline.

Repro (LF script, both sides)

arrayA=("A" "B" "C")
arrayB=( "${arrayA[*]}" )
echo "n=${#arrayB[*]} [0]=${arrayB[0]} [1]=${arrayB[1]-EMPTY}"

GNU Bash 5.3.0 (wsl env PATH=/usr/local/bin:/usr/bin:/bin HOME=/tmp/h /usr/local/bin/bash)

n=1 [0]=A B C [1]=EMPTY

rubash (target-wire/debug/rubash.exe, master 26728da)

n=3 [0]=A [1]=B

A quoted ${arr[*]} must join all elements with the first char of IFS into ONE word and must NOT be field-split, including inside a compound array assignment. Case01 (unquoted ${arrayA[*]}) matches; only the quoted form splits.

GNU anchor

  • subst.c:7600 chk_atstar() — quoted * handling (sets quoted_dollar_at/join semantics)
  • subst.c:11229 expand_word_internal() — quoted array-star join produces a single word; field splitting is suppressed for quoted expansions

Artifacts

  • probe: target-suite2/probes/p2-star-split.sh (both-side outputs alongside)
  • suite artifacts: target-suite2/results/new-exp/{gnu,rb}.{out,err} (stdout line 571)

Activity

  1. added
    bug
    gnu-baseline
    on Sep 27, 2026
  2. caomengxuan666 commented on Sep 27, 2026

    @caomengxuan666
    MemberAuthor

    已修复并合入 master(commit 4e9cb21c)。引号包裹的 ${arr[*]} 在复合赋值里现在保持为单个以 IFS 首字符连接的元素,非引号形态照常分裂(GNU subst.c string_list_dollar_star 语义)。回归测试同上文件,双引擎字节一致。感谢报告!

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

    buggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions