2bdb5be389
When calculating the length of the args that can be appended in a "find .... -exec something {} +" usage, remember to allow for the arg pointers, which form part of what is allowed in ARG_MAX. From a fairly empty installation of HEAD on amd64 and with a "/tmp/args" command that simply prints its arg count, and the length of the arg strings, with this mod I see .. netbsd# find / -exec /tmp/args {} + Argc 5000 Arglen 107645 Argc 5000 Arglen 151324 Argc 5000 Arglen 187725 Argc 5000 Arglen 206591 Argc 5000 Arglen 172909 Argc 5000 Arglen 186264 Argc 5000 Arglen 167906 Argc 2881 Arglen 98260 The upper limit of 5000 args is in the code. Using the biggest of those, 5000 args, plus 206591 bytes of strings uses 246591 bytes total (this excludes the command name, so add a few more). That's fairly close to the ARG_MAX of 262144. On another system (with longer paths) I see: (this is just a small part of the output, using a different version of the dummy command, and a slightly different invocation) Args: 4546 Len 218030 Args: 4878 Len 217991 Args: 4813 Len 218028 Args: 4803 Len 218029 There, 4878*8 + 217991 == 257015 which is about as close as we'd want to come to the arg limit. XXX pullup -8 |
||
---|---|---|
.. | ||
extern.h | ||
find.1 | ||
find.c | ||
find.h | ||
function.c | ||
ls.c | ||
main.c | ||
Makefile | ||
misc.c | ||
operator.c | ||
option.c |