gawk core dumped on too many input values

Jeremy Hetzler jeremyhetzler@gmail.com
Sun Aug 27 23:07:36 GMT 2023


On Sun, Aug 27, 2023 at 2:25 PM Ed Morton via Cygwin <cygwin@cygwin.com>
wrote:
>
> This (original email below) turned out to be a general cygwin issue, not
> a gawk issue:
>
> $ LC_ALL=C sed 's/x/y/' $(seq 1000000)
> Segmentation fault (core dumped)
>
> $ LC_ALL=C grep 'foo' $(seq 1000000)
> Segmentation fault (core dumped)
>

Seems that all commands linked with cygwin1.dll will fault if you pass them
a long enough arglist.

For me, /bin/true faults on {1..258231} but not {1..258230}.

> $ /bin/true {1..258230}
>


> $ /bin/true {1..258231}
> Segmentation fault (core dumped)


strace, which is not linked with cygwin1.dll, exits cleanly.

> $ /bin/strace {1..300000}
> -bash: /bin/strace: Argument list too long


See this page [1] on maximum argument lengths.

It would be nice to document this limit, whatever it is.

It would also be nice to return an error to the shell on too-long arglist.

$ cat true.exe.stackdump
>
Exception: STATUS_STACK_OVERFLOW at rip=7FFD41BD4646
> rax=0000000000051F10 rbx=0000000800009991 rcx=00000007FFE03C50
> rdx=00007FFD41BF58A0 rsi=0000000000000000 rdi=0000000000000000
> r8 =FEFEFEFEFEFEFF42 r9 =00007FFD41BF5820 r10=FEFEFEFEFEFEFEFF
> r11=FEFEFEFEFEFEFEFF r12=000000080000998D r13=00000007FFFFCDF0
> r14=0000000000000000 r15=0000000000000000
> rbp=00000007FFFFCD30 rsp=00000007FFFFCC38
> program=C:\cygwin64\bin\true.exe, pid 44496, thread
> cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
> Stack trace:
> Frame         Function      Args
> 0007FFFFCD30  7FFD41BD4646 (7FFD41A08035, 7FFD41A06F80, 000000000000,
> 000000000000) cygwin1.dll+0x1D4646
> 0007FFFFCD30  000000249F10 (7FFD41A06F80, 000000000000, 000000000000,
> 000000000000)
> 0007FFFFCD30  7FFD41BF5800 (000000000000, 000000000000, 000000000000,
> 000000000000) cygwin1.dll+0x1F5800
> 0007FFFFCD30  7FFD41A08035 (000000000000, 000000000000, 000000000000,
> 000000000000) cygwin1.dll+0x8035
> 0007FFFFFFF0  7FFD41A05C86 (000000000000, 000000000000, 000000000000,
> 000000000000) cygwin1.dll+0x5C86
> 0007FFFFFFF0  7FFD41A05D34 (000000000000, 000000000000, 000000000000,
> 000000000000) cygwin1.dll+0x5D34
> End of stack trace
> Loaded modules:
> 000100400000 true.exe
> 7FFD52F30000 ntdll.dll
> 7FFD52250000 KERNEL32.DLL
> 7FFD50940000 KERNELBASE.dll
> 0005EE2D0000 cygintl-8.dll
> 7FFD41A00000 cygwin1.dll
> 0003F9F70000 cygiconv-2.dll
> 7FFD51C70000 advapi32.dll
> 7FFD51FD0000 msvcrt.dll
> 7FFD525A0000 sechost.dll
> 7FFD52650000 RPCRT4.dll
> 7FFD4F3A0000 CRYPTBASE.DLL
> 7FFD50380000 bcryptPrimitives.dll



> $ uname -a
> CYGWIN_NT-10.0-22621 nzxt 3.4.8-1.x86_64 2023-08-17 17:02 UTC x86_64 Cygwin


Thanks,
Jeremy Hetzler

[1] https://www.in-ulm.de/~mascheck/various/argmax/


More information about the Cygwin mailing list