[Toybox] [PATCH] xargs: avoid "Argument list too long".

enh enh at google.com
Mon Oct 21 15:59:29 PDT 2019


ping. this is the missing one. let me know if you'd rather fix this
the "right" way, even though findutils really is this stupid. i don't
have a strong preference between "obviously right, but apparently
unnecessarily complicated" versus "obviously terrible, but easy and
no-one seems to care in practice" :-)

On Sun, Oct 20, 2019 at 10:39 PM enh <enh at google.com> wrote:
>
> It turns out that findutils xargs almost always uses an artificially low
> limit of 128KiB. You can observe this with --show-limits (which I
> refrained from adding to toybox since I believe it's only useful if
> you're debugging a broken xargs).
>
> I think an alternative fix for all this would be to go back to counting
> the cost of the (char *)s, but separate the -s limit from the "system"
> limit --- that way we could have the same behavior as findutils xargs
> for explicit values of -s (which we all seem to agree should *not*
> include the cost of the (char *)s), but also not accidentally overrun
> the actual system limits when we do count the (char *)s. That's more
> complicated though, and findutils' "128KiB is enough for anyone"
> behavior is demonstrably "good enough", so let's go with that for now.
>
> Tested by building an Android common kernel with toybox xargs, which
> failed before.
>
> Also tested with `find /usr | xargs > /dev/null`, which fails with
> toybox xargs even on my laptop.
>
>   ~$ find /usr | wc
>    262823  262835 15132761
>
> (On my desktop, even `find /proc` is sufficient to hit this!)
>
> Bug: http://b/140269206
> ---
>  toys/posix/xargs.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)


More information about the Toybox mailing list