On 7/10/26 6:28 AM, Julián Mateu wrote:

Bash Version: 5.3
Patch Level: 15
Release Status: release (installed via Homebrew; per the mechanism below, a
from-source build should also reproduce)

This appears to be very system-specific and the result of changes in recent
versions of macOS; see

https://lists.gnu.org/archive/html/bug-bash/2026-06/msg00126.html

for a detailed explanation.

Bash computes the pipe size at build time and assumes it doesn't change,
and, that if it does, there is a way to determine it at runtime.

I've never hit this on macOS 15 or 26, and the bash test suite uses here-
documents with sizes 512 <= doc <= 4096, 4096 <= doc <= 65536, and larger
than 65536. I would be shocked if the person who packaged bash for
homebrew didn't run the test suite, so we can assume they didn't encounter
this, either.

Description:
On macOS, a here-document whose body exceeds PIPE_BUF (512 bytes on Darwin)
makes bash 5.3 hang forever.

As above, the issue is a little bit more dynamic than that. Plus PIPE_BUF
is about write atomicity on pipes, not pipe capacity.


bash on Linux (64 KB pipe buffers) are
unaffected.

One nice feature Linux has is the ability to dyamically determine the pipe
buffer size using F_GETPIPE_SZ. It would be nice if macOS offered something
similar.


Repeat-By (self-contained, no external tools; run under bash 5.3 on macOS):

       printf -v body '%*s' 600 ''    # 600-byte body
       body=${body// /x}
       cat <<EOF
       $body
       EOF
       echo done # never printed on bash 5.3 / macOS

This is bash-5.3 on macOS: the first is a locally-built bash-5.3.15; the
second is from Macports.

$ uname -a
Darwin Mac.lan 24.6.0 Darwin Kernel Version 24.6.0: Tue Apr 21 20:15:34 PDT 2026; root:xnu-11417.140.69.710.16~1/RELEASE_ARM64_T6031 arm64
$ cat x2
printf -v body '%*s' 600 ''    # 600-byte body
body=${body// /x}
cat <<EOF
$body
EOF
echo done # never printed on bash 5.3 / macOS
$ ../bash-5.3-patched/bash ./x2
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
done

There will be a fix derived from the bug-bash message above in the next
devel branch push.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to