Skip to content

parser: case ... esac | cmd — case command as a pipeline stage is rejected (GNU accepts) #385

Closed

Description

@caomengxuan666

Found during wt33 triage of #373. Real semantic gap (not a stale assertion — the AST test asserting pipeline_command for a case stage is left ignored until this is fixed).

Repro (script file, both shells)

target/issue-suites/results/wt33-373/cases/B07_case_pipe.sh:

case $w in yes) echo yes ;; *) echo no ;; esac | grep yes
echo rc=$?

WSL GNU Bash 5.3.0:

rc=1        (pipeline runs: `echo no` is filtered out by grep; outer rc from grep)
empty stderr

rubash:

(empty stdout)
stderr: <script>: line 1: syntax error near unexpected token `|'
        <script>: line 1: `case $w in yes) echo yes ;; *) echo no ;; esac | grep yes'
rc 2

Notes

  • Raw artifacts: target/issue-suites/results/wt33-373/run/B07_case_pipe.* and A21_case_pipeline.* (byte-compared by run_cases.sh).
  • Owning area: case-command terminator admission in the parser (esac ends the command; a following | should continue the pipeline grammar instead of erroring — GNU parse.y case_command is a compound_command which pipelines accept).
  • Test left as tracker: tests/parser_tests.rs test_case_command_pipeline_stage (#[ignore] referencing this issue).

Activity

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

    @caomengxuan666
    MemberAuthor

    Landed on master (wt37/gapfix1 batch, CI green on bbccb1c): see the issue-suite tests/issue385_*_regressions.rs and the lane's two-shell matrices on the ticket trail. Master carries the fix; suites green.

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