[Toybox] [landley/toybox] xargs: exec ... Argument list too long (#40)
Rob Landley
rob at landley.net
Fri Sep 29 16:53:07 PDT 2017
And after deleting the mailing list archive again, dreamhost restored
from a 3 day old backup that doesn't contain this entire thread.
Wheee...
Rob
On 09/28/2017 10:18 AM, enh wrote:
> Did you look at my xargs patch in this thread? It handles all that. I
> think the find patch is pretty similar, I just haven't had time to set
> up a working test case. (Or rather I fell into ratholes while doing so.)
>
> On Sep 28, 2017 04:41, "Rob Landley" <rob at landley.net
> <mailto:rob at landley.net>> wrote:
>
> Sorry, yes I did get time to look at this, I just haven't _fixed_ it
> yet.
>
> The problem is that environment variables and arguments both fit in the
> same space, which is dynamic at 1/4 the stack size limit as mentioned at
> http://lists.landley.net/pipermail/toybox-landley.net/2016-August/008592.html
> <http://lists.landley.net/pipermail/toybox-landley.net/2016-August/008592.html>
> last time around.
>
> Which means that _any_ static size we enforce isn't guaranteed to work,
> if you have a lot of environment variables defined (or just one really
> big one). Environment varaibles can even consume the space to the point
> you can't launch a _single_ argument. (If it's less than PATH_MAX, we
> have a problem.)
>
> So I think it has to probe, and be dynamic, and at least not _loop_ when
> find produces a single long name that's more than the remaining
> environment space to launch a child. (I.E. test the corner case that the
> maximum number of args we can fit is zero.)
>
> Space consumption should be exactly sizeof(char *)*(argc+1) +
> sizeof(char *)+(envc+1) + the strlen+1 of all the argv[] + the strlen+1
> of all the envp[]. I need to test that's still the case (it used to be
> when the limit was hardwired 32*4096).
>
> Sorry for the delay, still juggling way more things than I have energy
> for. :(
>
> Rob
>
More information about the Toybox
mailing list