Skip to content

[bug] Over-lax parse: unclosed quote in here-doc delimiter accepted (cat <<'E <newline> E) runs instead of 'unexpected EOF looking for matching quote' #351

Closed

Description

@caomengxuan666

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

Repro (2-line file):

cat <<'E
E

GNU 5.3.0: rc=2, stderr line 1: unexpected EOF while looking for matching ''` — the delimiter word's quote is unterminated, a parse error.
rubash: rc=0, no output, no error — accepts the token.

GNU C owner: parse.y read_token_word() (parse.y:5305) — the here-doc delimiter is read as a word; an unmatched quote must fail at EOF exactly like any other word (parse.y:5366-5398 backslash/quote state machine).
Artifacts: target/issue-suites/results/gnusweep3/cat8/case/h034.; minimal target/issue-suites/results/gnusweep3/probes/min/m17-heredoc-unterm-quote.

Activity

  1. added
    bug
    gnu-baseline
    on Sep 30, 2026
  2. added 2 commits that reference this issue on Sep 30, 2026
  3. caomengxuan666 commented on Sep 30, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by wt20/deepsweep (437cd6eb): heredoc delimiter unclosed quote is a GNU-exact rc=2 EOF error (read_token_word parse.y:5419-5437; the driver blanket !contains("<<") guard hid it; expect_delim-gated after a first cut broke heredoc.tests 5->126 and was corrected).

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