Skip to content

[parse] word-attached multi-line process substitution word<( NL ... NL ) rejected — GNU accepts (breaks json.bash jb-cli example) #463

Closed

Description

@caomengxuan666

Construct (minimal repro)

echo outer<(
echo inner
)

rubash -n (fresh master a157656, release build):

tc.sh: line 3: syntax error near unexpected token `)'

GNU bash 5.3.0 accepts this file: the process-substitution body is a command list; newlines are ordinary body characters and the matching ) closes it.

Boundaries measured on the fresh build:

construct rubash -n GNU 5.3
cat <(echo hi) (space-separated, single line) ok ok
cat <( NL echo hi NL ) (space-separated, multi-line) ok ok
echo <(echo hi) (attached, single line) ok ok
echo outer<( NL echo inner NL ) (attached, multi-line) syntax error at ) ok
jb x@<( NL ... NL ) (attached via @) syntax error at ) ok
x=$(cat <( NL echo hi NL )) ok ok

Only the word-attached form (word immediately followed by <(, no space) fails when the body spans lines. The closing ) of the body is reported as "unexpected token".

Real-world evidence (ecosystem harvest)

h4l/json.bash/examples/jb-cli.sh, lines 35-41 (harvest 2026-10-04) — the json.bash jb CLI nesting example:

jb menu:json@<(
  jb id=file value=File popup:json@<(
    jb menuitem:json[]@<(
      jb value=New onclick="CreateNewDoc()"; \
      ...
    )
  )
)
  • WSL GNU Bash 5.3.0 bash -n: rc=0 on the whole file (recorded oracle, harvest 2026-10-04/05)
  • Git Bash 5.2 grammar: rc=0 (non-authoritative corroboration)
  • rubash master a157656 rubash -n: rc=2, syntax error near unexpected token ')' at the body's closing paren.

GNU C source anchor (vendored bash.git @b4608166, Bash-5.3 patch 15)

  • parse.y:3793-3797 read_token() — the lexer explicitly falls through to word-reading when a </> is followed by (: if MBTEST((character != '>' && character != '<') || peek_char != '(') return (character); — i.e. word<( is read as a word whose substitution body is consumed by the word reader, with the body handled by the same matched-pair/comsub discipline that treats newlines as body characters (cf. parse_matched_pair LEX_GTLT tracking of <( ... ), parse.y:4147-4153 and 4193-4195).

Classification

Parser divergence (process-substitution body scan when attached to a word). Multi-line bodies via the space-separated form already work, so the body-reading machinery exists — the word-attached admission path does not span newlines.

Activity

  1. added
    bug
    gnu-baseline
    P3-low
    on Oct 9, 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

    P3-lowbuggnu-baseline

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions