Skip to content

regression(8c52cb7f): wholly-quoted compound-assignment element undergoes pathname expansion — arr=("$x") globs when x='*' #369

Closed

Description

@caomengxuan666

Found by ecosweep4-B triage lane (wt23/bats364, 2026-10-01); bisected on this machine with throwaway worktrees.

Reproducer (byte-verified vs WSL GNU Bash 5.3.0 script-file run)

mkdir -p /tmp/gpdir && cd /tmp/gpdir && touch aa bb
x="*"
arr=("$x" literal); printf '[%s]' "${arr[@]}"
  • GNU 5.3.0: [*][literal] — a wholly-quoted element is data; pathname expansion needs an UNQUOTED glob char in the word (subst.c expand_word_list / arrayfunc.c assign_array_var_from_word_list: quoted elements carry W_QUOTED and never reach the globber).
  • rubash @ 8f89767 (2026-09-27): [*][literal] (correct)
  • rubash @ 8c52cb7 (2026-09-28, "Array compound elements: exactly one quote-removal pass (rubash#288)") through HEAD: [aa][bb][literal] — the quoted element's expansion result is pathname-expanded.

Introducing commit

8c52cb7 (verified good at its ancestor region 8f89767; bad at 8c52cb7; still bad at 2e6b0e9). 116b12a (fix #295 expansion-result protection carriers, 2026-09-29) did not repair it.

Scope

  • Only elements that are ENTIRELY a quoted parameter expansion ("$x") leak. Partial-quote (pre"$x") and literal single-quote ('*.txt') elements are fine.
  • The failing parser_tests white-box family (assignment_tests::*, ~55 reds asserting compound_assignments/quote metadata) overlaps this domain: several of those assertions document the quote metadata whose loss produces this bug. After the fix, that family needs a re-triage (most of it is stale structural assertions, but this specific behavior is a real GNU divergence).

Activity

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

    @caomengxuan666
    MemberAuthor

    Landed as 8c5fc86 (wt24/regfix lane commit 1d2fecc9). BISECT CORRECTION: the real introducer was 306436d (whole-word $param elements #198/#194/#78), NOT 8c52cb7 as this issue recorded — the issue's verdicts were polluted by stale binaries; #288's fix is untouched and orthogonal. Fix: the quoted whole-word compound element transports as the plain quoted storage word (the store! product form), not the ARRAY_FIELD_SPLIT_MARKER token reserved for unquoted field-split products, so the W_QUOTED state survives to the glob gate (GNU arrayfunc.c:575 -> subst.c:11862 add_quoted_string -> pathexp.c:120 CTLESC skip). 20-case class matrix byte-identical; unquoted controls still glob; array 264/new-exp 495 slices unchanged; tests/issue369_* 7/7. CI green on 085c6a7.

  4. added 2 commits that reference 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions