bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: execve E2BIG (Argument list too long)


From: Michael Green
Subject: Re: execve E2BIG (Argument list too long)
Date: Thu, 1 Oct 2020 09:53:47 +0200

Ok, I think that explains most of what I am seeing.

I can indeed swap variable name characters for more characters in my
overly long export.

I'm no longer sure what I was seeing with the sourcing line, it seemed
to have an effect on my tests yesterday but I can now add or remove
this without triggering the effect.

Looking at the man for execve, I see that the argument and environment
variables are packed into 2 arrays of strings. I seem to be running
into the MAX_ARG_STRLEN limit of 128k - which is the size of the
smallest string that is triggering this error code.

I am able to pass more arguments or more env variables until I hit the
absolute limit - presumably ARG_MAX which for me is 2048k.

The absolute vs local paths when calling the script is a bit weird. I
wouldn't have thought it would effect the env of the execve call - I'm
still calling from the same directory - and even if it did affect the
environment then providing an absolute path would have increased its
size, but calling it with the absolute path reduces the expansion of
"${BASH_ARGV[*]}" by 18 characters which is the length of my path.


On Wed, Sep 30, 2020 at 5:39 PM Chet Ramey <chet.ramey@case.edu> wrote:
>
> On 9/30/20 3:12 AM, Michael Green wrote:
>
> > Bash Version: 5.0
> > Patch Level: 17
> > Release Status: release
> >
> > Description:
> >
> > The included short script when run with the following command results
> > in execve "E2BIG (Argument list too long) errors".
>
> The argument list includes the size of the environment, and your script
> creates a huge environment variable.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]