delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/05/15:26:53

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <431C9BEA.90606@byu.net>
Date: Mon, 05 Sep 2005 13:26:34 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: xargs: argument list too long - new problem with v.4.2.25
References: <20050905105033 DOT 075464A8848 AT cgf DOT cx> <20050905152330 DOT GD609 AT trixie DOT casa DOT cgf DOT cx>
In-Reply-To: <20050905152330.GD609@trixie.casa.cgf.cx>
X-IsSubscribed: yes

-----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 AT byu DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019