sudo and xargs disagree about maximum command line length

Stijn Hoop stijn at win.tue.nl
Wed Aug 10 21:00:47 GMT 2005


On Wed, Aug 10, 2005 at 10:55:28PM +0200, Björn König wrote:
> Stijn Hoop wrote:
> 
> >I think the below should not happen:
> >
> >[stijn at tangaloor] </net/freebsd/ports> find . | grep CVS/Root | xargs sudo 
> >-u src sed -i.bak -e 's#/freebsd#/net/freebsd#'
> >sudo: unable to execute /usr/bin/sed: Argument list too long
> >sudo: unable to execute /usr/bin/sed: Argument list too long
> >sudo: unable to execute /usr/bin/sed: Argument list too long
> >sudo: unable to execute /usr/bin/sed: Argument list too long
> >
> >Is there a sudo knob that should be tweaked?
> 
> Use the parameter -L of xargs
> 
>   ... | xargs -L3 command
> 
> xargs will pass only three lines from input as argument to the command, 
> i.e. it executes
> 
>   command line1 line2 line3
>   command line4 line5 line6
>   ...
> 
> instead of
> 
>   command line1 line2 line3 line4 line5 line6 ...
> 
> which often causes 'Argument list too long'.

Hmm, I thought the point of xargs was to construct argument lists that
aren't too long? I can work around it with -n or -L, sure, but why
can't xargs cap it then?

What's going on above (I think) is sudo re-execing sed and enforcing a
lower limit on the command line than xargs. I think this is bogus.  If
that's not what's happening, why does xargs construct an argument list
that is too long then?

--Stijn

-- 
SIGSIG -- signature too long (core dumped)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20050810/220710c2/attachment.bin


More information about the freebsd-ports mailing list