bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Maximum limit of pipes in a single command ?


From: Eric Blake
Subject: Re: Maximum limit of pipes in a single command ?
Date: Thu, 28 Aug 2008 22:31:57 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Dave B on 8/28/2008 9:24 AM:
> 
> If I replace 3332 with 3333, bash gives
> 
> bash: line 1: syntax error near unexpected token `|'
> 
> Curiously, with this command
> 
> (printf 'echo a';for i in `seq 1 3330`;do printf '|(read a;echo $a)';
> done;echo) | bash
> 
> the limit is 3330.

Another limit is 2499 for nested elif constructs within a single if/fi (I
hit that when trying to stress-test autoconf).  These limits are probably
determined by bison, which defines YYMAXDEPTH to 10000 if not otherwise
specified, where the 10000 is then divided by how many tokens appear in
the recursion sequence.  The alternative to these arbitrary limits is
unbounded stack growth, but without the use of GNU libsigsegv, it is very
difficult to distinguish stack overflow from real SEGV on many modern
architectures (including Linux).

> 
> Ulimit tells me that the maximum number of user processes is 16381, so it
> seems unrelated to that.

But not all platforms support that many simultaneously open pipes; so on
other platforms, the limit will be smaller than the bison-enforced parser
limit.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAki3e70ACgkQ84KuGfSFAYAyxACeLKWPiKzn8MHf+PjHAEstGAG5
RsIAn2LFqSGuNmZDsxbPaMEZzVikYG6R
=OFih
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]