Originally Posted By: Hal Itosis
Originally Posted By: CharlesS
The xargs tool cuts off at ARG_MAX. -exec + seems to be cutting off at half that, hence 128 KiB, causing twice as many command lines to be executed. In neither case is the command line length able to exceed ARG_MAX.

The bit that caused me to smile back there was where you said 128 KiB had "already been established" —yet, that was the very first mention of "128" in this thread.

It had already been established that it was cutting off earlier than xargs, which was the point. Since it generated about twice as many command lines when run on a large number of files with approximately equal lengths, it implied it was cutting off at about half the limit. 256 / 2 == 128. A little bit of testing seemed to support this. Sorry if I wasn't clear.

If you want, you can easily verify that. Just create a small program (or script, that works too) that logs the length of the argument list it's given, and have find pass its arguments to it. When I did it, they all ended up coming in slightly around 131072, or 128 KiB. I don't actually know if it's a hard limit or not (maybe not, since some seem to go slightly over 131072 when the null byte at the end of each string is taken into account), but they all seem to hover around that value. I'd have to look at the code to see what exactly it's doing, but I don't have time, and it really doesn't matter much anyway.

Anyway, I think this thread has served its purpose, so I'm done here.