On 2023-08-28 05:47, Joshuah Hurst via Cygwin wrote:
On Mon, Aug 28, 2023 at 1:08 AM Jeremy Hetzler via Cygwin
<cygwin@cygwin.com> wrote:
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.
Is this limit?
$ getconf -a | grep -E 'ARG_MAX'
_POSIX_ARG_MAX 4096
ARG_MAX 32000
On my system, /bin/true and /bin/echo get to between 250K and 256K before seg
faulting, requiring between digits + separator + ptr (10+8)*(250-256)KB ==
3750-3840KB;
current Cygwin and `bash` `:` and `echo` internal commands get to between 128M
and 256M before `bash` fork fails, and Windows gets unhappy with memory full,
paging high, and page thrashing on both paging devices: calmed eventually with a
few interrupts then `exec bash`;
requiring between digits + separator + ptr (10+8)*(128-256)MB == 2.25-4.5GB;
This seems to be extremely conservative:
$ xargs -r --show-limits <<< ' '
Your environment variables take up 9246 bytes
POSIX upper limit on argument length (this system): 20706
POSIX smallest allowable upper limit on argument length (all systems): 4096
Maximum length of command we could actually use: 11460
Size of command buffer we are actually using: 20706
Maximum parallelism (--max-procs must be no greater): 2147483647
$ seq $((256*1024)) | xargs | wc -lwcL
102 262144 1723903 18094
Once a patch is in a test version of Cygwin, I can rebuild and release a test
version of findutils, which includes xargs, with updated results in the test
release announcement.
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple