Hello all,
I'm observing a strange error: When a subshell spawned with command
substitution uses a pipe, it crashes with a Stack Overflow.
Hence, the following doesn't work: `var=$( echo hello world | cat - )`
(More detailed reproducer attached.)
I'm using GNU bash, version 4.4.19(3)-release (x86_64-pc-msys) on Windows 11.
This bash is packaged by a company that provides it as part of their SDK. I'm
already in contact with their support but am doing my own research in parallel.
They currently seem unable to reproduce.
Does this problem look familiar to someone?
I hope it's a known problem that's fixed in a later version, so I could suggest
a fix by upgrading the bash.
Best regards,
Manuel Wagesreither
C:\Users\username\testdir>@REM Set PATH so we can invoke cat in reproducer.bash
C:\Users\username\testdir>PATH=C:\Users\username\vendor800\host\win64\x86_64\usr\bin\
C:\Users\username\testdir>echo %PATH%
C:\Users\username\vendor800\host\win64\x86_64\usr\bin\
C:\Users\username\testdir>
C:\Users\username\testdir>dir
Volume in drive C is Windows
Volume Serial Number is 4C55-A35B
Directory of C:\Users\username\testdir
19 Mar 2026 14:01 <DIR> .
19 Mar 2026 13:27 <DIR> ..
19 Mar 2026 13:58 196 reproducer.bash
1 File(s) 196 bytes
2 Dir(s) 368.304.173.056 bytes free
C:\Users\username\testdir>
C:\Users\username\testdir>type reproducer.bash
#!/bin/bash
echo MANUELDEBUG begin of tester, parameters: $@
var1="$( echo ONE )"
echo "${var1}"
var2="$( echo TWO | cat - )"
echo "${var2}"
echo THREE | cat -
echo MANUELDEBUG end of tester
C:\Users\username\testdir>
C:\Users\username\testdir>C:\Users\username\vendor800\host\win64\x86_64\usr\bin\bash.exe
.\reproducer.bash
MANUELDEBUG begin of tester, parameters:
ONE
THREE
MANUELDEBUG end of tester
C:\Users\username\testdir>
C:\Users\username\testdir>dir
Volume in drive C is Windows
Volume Serial Number is 4C55-A35B
Directory of C:\Users\username\testdir
19 Mar 2026 14:02 <DIR> .
19 Mar 2026 13:27 <DIR> ..
19 Mar 2026 14:02 538 bash.exe.stackdump
19 Mar 2026 13:58 196 reproducer.bash
2 File(s) 734 bytes
2 Dir(s) 368.303.947.776 bytes free
C:\Users\username\testdir>
C:\Users\username\testdir>type bash.exe.stackdump
Exception: STATUS_STACK_OVERFLOW at rip=7FFAB70D4BC7
rax=0000000000001058 rbx=00000000FFFFBA30 rcx=0000000180010018
rdx=00000000006387B0 rsi=0000000180275F00 rdi=0000000180221430
r8 =0000000180275F00 r9 =0000000180275F00 r10=00000000FFFFA000
r11=00000000FFE03D80 r12=00000000FFFFB910 r13=0000000180221430
r14=00000000FFFFB8B0 r15=00000000FFFFBA38
rbp=0000000000000420 rsp=00000000FFFFB7E0
program=C:\Users\username\vendor800\host\win64\x86_64\usr\bin\bash.exe, pid
10676, thread
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B