Skip to content

[bug] extglob pattern with quoted metachars not matched in pathname expansion: echo @('a b') returns the literal pattern (GNU matches the file 'a b') #350

Closed

Description

@caomengxuan666

Found by gnusweep3 lane (cat7 g033; WSL GNU Bash 5.3.0 oracle, worktree 0fe8d0f).

Repro:

mkdir -p gfix
cd gfix
: > 'a b'
shopt -s extglob
echo @('a b')     # GNU: a b      rubash: @(a b)
cd ..
rm -rf gfix

rubash returns the literal pattern when the extglob pattern contains quoted characters; GNU strips the quotes inside the extglob group and matches the filename with the space. Non-quoted extglob pathname patterns work (g021/g032/g042 PASS).

GNU C owner: subst.c:2329 — (flags & SD_EXTGLOB) && extended_glob && string[i+1] == LPAREN && member (c, "?*+!@") — quote handling inside the extglob group during word expansion, feeding glob pattern compilation (glob/gmatch).
Artifacts: target/issue-suites/results/gnusweep3/cat7/case/g033.; minimal target/issue-suites/results/gnusweep3/probes/min/m16-extglob-pathname.

Activity

  1. added
    bug
    gnu-baseline
    on Sep 30, 2026
  2. added a commit that references this issue on Sep 30, 2026
  3. caomengxuan666 commented on Sep 30, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by wt20/deepsweep (86294c0c): pathname suppression is now per-character — an unquoted extglob opener keeps the glob (parse.y:5466-5489, glob.c udequote_pathname).

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