Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Apr 2001 23:02:05 +0100
From:      Brian Somers <brian@Awfulhak.org>
To:        freebsd-current@FreeBSD.ORG
Cc:        brian@Awfulhak.org
Subject:   Re: cp -d dir patch for review (or 'xargs'?) 
Message-ID:  <200104232202.f3NM25607648@hak.lan.Awfulhak.org>
In-Reply-To: Message from Oliver Fromme <olli@secnetix.de>  of "Mon, 23 Apr 2001 15:08:27 %2B0200." <200104231308.PAA18220@lurza.secnetix.de> 

index | next in thread | previous in thread | raw e-mail

> Rodney W. Grimes <freebsd@gndrsh.dnsmgr.net> wrote:
>  > > Before anyone starts writing scripts, consider that {} will be 
>  > > replaced by xargs with (roughly) ARG_MAX - 10 characters worth of the 
>  > > stuff coming off the pipe.  If your combined arguments plus 
>  > > environment exceeds ARG_MAX execve(2) will give you E2BIG.
>  > 
>  > No rain here, it is ARG_MAX - 2048:
>  >      -s size
>  >              Set the maximum number of bytes for the command line length pro-
>  >              vided to utility. The sum of the length of the utility name and
>  >              the arguments passed to utility (including NULL terminators) will
>  >              be less than or equal to this number.  The current default value
>  >              for size is ARG_MAX - 2048.
>  > 
>  > 2K would be a pretty big env, root default std is about 367 bytes.
>  > 
>  > Yes, that is probably not a portable assumption to make, but it is
>  > far better than using non-standard options to xargs.
> 
> If I'm not mistaken, the size of the environment is already
> taken into account by the xargs utility (subtracted from
> ARG_MAX).  So this isn't an issue at all.

Unless xargs runs a command with lots of arguments and that command 
increases the environment size then tries to run another command with 
the same arguments - bang (E2BIG).

> Regards
>    Oliver
> 
> -- 
> Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München
> Any opinions expressed in this message may be personal to the author
> and may not necessarily reflect the opinions of secnetix in any way.
> 
> "All that we see or seem is just a dream within a dream" (E. A. Poe)

-- 
Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
      <http://www.Awfulhak.org>;                   <brian@[uk.]OpenBSD.org>
Don't _EVER_ lose your sense of humour !



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104232202.f3NM25607648>