Subject: Re: xargs
To: None <tech-userlevel@netbsd.org>
From: Denis Lagno <dlagno@rambler.ru>
List: tech-userlevel
Date: 03/28/2006 17:54:37
On Tue, Mar 28, 2006 at 03:29:40PM +0200, joerg@britannica.bec.de scribed:
> On Tue, Mar 28, 2006 at 01:19:52PM +0200, Hubert Feyrer wrote:
> > 
> > Looking at xargs sources, it uses ARG_MAX, which wasn't touched in the 
> > last 12 years. I'm not sure where the counterpart of the kernel is 
> > defined. Looking at ktrace output may help.
> 
> ARG_MAX is 256k, that's why I asked for kern.argmax. It is not pretty
> and should be improved, but that doesn't seem to be the issue.
> 
> I should add that I can't reproduce this on my own system.

This bug somehow depends on average length of each argument,
not on the total length of list of arguments.
Big length of each argument triggers the bug for me:

$ cd /
$ find /var/worksrc/netbsd-current/src/sys | xargs echo > /dev/null 
xargs: echo: Argument list too long
$ cd /var/worksrc/netbsd-current/src/sys                                         
$ find . | xargs echo > /dev/null              
$ find . | wc -c
  869870

-- denis