> On 02/09/06 12:12, Justin Pryzby wrote:
> > So, I think this bug is fully understood.  /bin/egrep just calls
> > grep -E "$@", so if $@ is MAXARGS-1, the -E puts it over the edge.
> > The error starts with "/bin/egrep" since that is the name of the
> > command; if you were to mv /bin/{egrep,foo} then it would say
> > "/bin/foo: /bin/sh: bad interpretter: arg list too long" since it is
> > being interpretted by /bin/sh.
> > 
> > Can this bug be closed?

On Fri, Feb 10, 2006 at 11:06:32AM -0800, Kingsley G. Morse Jr. wrote:
> Yes, but, $@ is not anywhere near as big as
> MAXARGS. 
> 
> As you can see below, only seven "arguments" are
> passed to egrep.
Actually, only 2 arguments: "egrep" and "is now ..."

The problem is that ARG_MAX applies to the sum of envp and argv; see
execve(2).  So grep -E is being called with a massive environment.
Try sourcing the script, and then running certain commands..

[EMAIL PROTECTED]:/tmp$ ls aaaaaaaaaaaaaaaaa 
ls: aaaaaaaaaaaaaaaaa: No such file or directory
[EMAIL PROTECTED]:/tmp$ ls aaaaaaaaaaaaaaaaab
bash: /bin/ls: Argument list too long

Justin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to