Dash 0.5.12 bug - POSIX process substitution $() handling error with embedded comments

Jari Aalto <[email protected]> Mon, 26 Jan 2026 13:55:24 +0200
Newsgroups org.kernel.vger.dash
Message-ID <CAOU7Hif8YDD-EAvqEV24_YAP5N32j=gh7zca=oXY8MfbUPQcYA@mail.gmail.com>
Machine: x86_64
OS: linux-gnu
uname output: Linux congo 6.1.0-6-amd64 #1 SMP PREEMPT_DYNAMIC Debian
6.1.15-1 (2023-03-05) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Dash Version: 0.5.12-12 (Debian/testing)

DESCRIPTION:

POSIX command substitution does not work with comments.

REPEAT-BY:

See code below.
- The old backtics `` work
- The modern $() doesn't

FIX:

The process substitution is defined in POSIX and
should work identically in both cases.

COMMAND:

bash -x <code>

OUTPUT:

++ echo 1
+ x=1
+ x=
posix-test--process-substitution.sh: line 13: unexpected EOF while
looking for matching `)'

CODE: posix-test--process-substitution.sh

#! /bin/sh

# OK
x=$(echo 1)

# OK
x=`# comment`

#  Syntax error: end of file unexpected (expecting ")")
x=$(# comment)

# End of file