Adjust maximum argument length for illumos#12
Conversation
tavianator
left a comment
There was a problem hiding this comment.
I checked how Illumos's xargs handles this, and...
#define MAXARGS 255which seems a little pessimistic :)
So I think this is a fine approach, I just have the one comment.
Yes, and https://github.com/illumos/illumos-gate/blob/master/usr/src/cmd/find/find.c#L77 uses
Done, thanks. |
|
Hmm, actually the
And in
Which means that for the somewhat archaic case of executing a shell script without a shebang line, 255 args is really a hard limit for $ cat >noshebang.sh <<EOF
# No shebang line
echo "\$@"
EOF
$ chmod +x noshebang.sh
$ ./noshebang.sh $(yes | head -n256)I don't think dropping the limit to 255 args on Illumos is reasonable--I think this PR is fine as-is. One possible workaround for a follow-up PR would be to resolve the executable against the Having said that, I think Rust might use
This is not a security issue as long as Illumos has a stack guard page, but it's not great :/ |
|
That particular example seems ok: It seems like this might be worth delving more into though, thanks! |
|
Ah, well I see that Illumos's |
|
I haven't followed the full discussion (but I can catch up if needed). What is the current state of this PR? |
|
It looks fine to me! |
While using
rustfd's-Xoption on an illumos system with a long list of files, I see:This turns out to be because
stringsis a 32-bit program, which has a lower argument length limit than a 64-bit one.Running this crate's tests on illumos fails:
sysconfig(ARG_MAX) is 2096640 for a 64-bit process and 1048320 for 32-bit.
Also defined in
<limits.h>The experimental limit using
/usr/bin/echo(32-bit) is 1570369The experimental limit using
/usr/bin/amd64/echo(64-bit) is 2095129I do not know a good way to retrieve the 32-bit value from the 64-bit rust process, but halving seems like a reasonable workaround.
With this fix, all crate tests pass (and rustfd patched to use this branch also works).