This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xargs: argument list too long - new problem with v.4.2.25


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

According to Christopher Faylor on 9/5/2005 9:23 AM:
> I used to compile findutils with -DARG_MAX=150000 on the gcc command
> line to work around this problem.  Undoubtedly there is a better way to
> do this, but maybe this is a hint as to what's wrong.

As a workaround, you can use `xargs -s 13000' to approximate the limit
that 4.2.11-CVS was using.

There's definitely a change in behavior, although looking at the CVS
history
(http://savannah.gnu.org/cgi-bin/viewcvs/findutils/findutils/xargs/xargs.c),
I can't pin down where the change is coming from since neither
sysconf(_SC_ARG_MAX) nor xargs' call to that function has changed since
Dec 04 (I think Chris was using -DARG_MAX=15000, not 150000):

$ xargs --version
GNU xargs version 4.2.11-CVS
$ echo | xargs --show-limits
Your environment variables take up 3054 bytes
POSIX lower and upper limits on argument length: 2048, 12952
Maximum length of command we could actually use: 9898
Size of command buffer we are actually using: 9898

$ xargs --version
GNU xargs version 4.2.25
$ echo | xargs --show-limits
Reducing arg_max (1043474) to arg_size (134126)
Your environment variables take up 3054 bytes
POSIX lower and upper limits on argument length: 2048, 1046528
Maximum length of command we could actually use: 1043474
Size of command buffer we are actually using: 134126

xargs now discovers arg_max (1 meg) by calling sysconf(_SC_ARG_MAX); then
reduces it to arg_size (130k), calculated by (128*1024) + environment
size, as its optimal guess in the absense of the -s option.

Sure enough, looking at cygwin's sysconf.cc,
      case _SC_ARG_MAX:
	/* FIXME: what's the right value?  _POSIX_ARG_MAX is only 4K */
	return 1048576;

Since Windows has a 32k command-line limit in CreateProcess, maybe we
should reduce this to 32k rather than 1 meg, thus fixing the FIXME as well
as xargs.  Also, it may be worth adding ARG_MAX to limits.h, although with
mount -X it is possible to exceed ARG_MAX.  In the meantime, I will
release 4.2.25-2 with a workaround.

- --
Life is short - so eat dessert first!

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

iD8DBQFDHJvq84KuGfSFAYARAp0MAKCYCAfLnyXffjm+KuTHhoMURuzwRwCfViXJ
S/YZNv0iG8vBHDJ5IAdV1Zs=
=xhVy
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]