bash hangs when executing a script with a here document larger than 64 K
From:
Bruno Haible
Subject:
bash hangs when executing a script with a here document larger than 64 KiB
Date:
Wed, 17 Sep 2025 21:39:15 +0200
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: cygwin
Compiler: gcc
Compilation CFLAGS: -ggdb -O2 -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4
-fdebug-prefix-map=/cygdrive/d/a/scallywag/bash/bash-5.2.21-1.x86_64/build=/usr/src/debug/bash-5.2.21-1
-fdebug-prefix-map=/cygdrive/d/a/scallywag/bash/bash-5.2.21-1.x86_64/src/bash-5.2.21=/usr/src/debug/bash-5.2.21-1
uname output: CYGWIN_NT-10.0-19045 laridus 3.6.4-1.x86_64 2025-07-15 07:55 UTC
x86_64 Cygwin
Machine Type: x86_64-pc-cygwin
Bash Version: 5.2
Patch Level: 21
Release Status: release
Description:
============
bash hangs when executing a very particular config.status script.
Repeat-By:
==========
./config.status
or
sh -x ./config.status 2>&1 | tee config.status.xlog
Notes:
======
It hangs while executing a here document whose size is 65563 bytes.
That is very close to 64 KiB.
If I remove 27 or more bytes from this here document, e.g. in line 2544,
the execution of './config.status.good' succeeds.
Note that 65563 - 27 = 65536 = exactly 64 KiB.
I have verified that none of the Cygwin patches to bash 5.2.21 looks
like a possible cause of the hang (by inspection, not by rebuilding bash).