Skip to content

[bug] Parser accepts GNU-invalid constructs: empty subshell ( ), empty do-body (do; done), foo=([), [[ == (b|c)* ]] without extglob shopt #221

Closed

Description

@caomengxuan666

Found via mvdan/sh parser-corpus -n parity run (ecosuite lane; family 2 of 3). rubash -n returns 0 where WSL GNU Bash 5.3.0 errors:

file input rubash GNU bash 5.3.0
t0169.sh ( ) 0 2 (near unexpected token ))
t0173.sh while false; do; done 0 2 (near unexpected token done)
t0459.sh foo=([) 0 1 (unexpected EOF while looking for matching ))
t0415.sh [[ a == (b|c)* ]] 0 2 (unexpected argument ()

GNU C source owners:

  • ( ): parse.y subshell grammar requires a non-empty compound_list (empty subshell is a parse error since bash treats ) with no command as unexpected token).
  • do; done: loop body is compound_list — must not be empty.
  • foo=([): parse.y array-assignment word scan requires balancing [ subscripts; EOF inside the assignment word is an error, not a silent accept.
  • [[ a == (b|c)* ]]: extglob pattern characters are only special when shopt extglob is on at PARSE time — without it, ( is an unexpected argument inside [[ ]]. This is the same parse-time extglob gate family as rubash#131/[bug] extglob case 模式未按解析时 shopt extglob 门控(case x in @(a|b)) 在 -n 下被静默接受,GNU 拒绝) #143 (those covered -n mode generally and case patterns; this one is the [[ == ]] pattern position with no shopt at all).

Artifacts: target/issue-suites/results/ecosuite/mvdan-n/ (matrix/diverge + per-file stderr), corpus target/ecosuite/mvdan-corpus/.

Lane: wt4/ecosuite evaluation suites (no src/ fixes in lane).

Activity

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

    @caomengxuan666
    MemberAuthor

    已修复并合入 master(commit d3e8aff,lane wt4/ecofix,GNU 引用见提交;探针/夹具与 WSL GNU 5.3.0 字节一致)。感谢报告!

  3. added a commit that references this issue on Sep 29, 2026
  4. added
    bug
    area:parser
    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:parserbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions