I'm not going to do this, sorry. I'll only answer the one question that contained actual technical content:

Originally Posted By: Hal Itosis
Originally Posted By: CharlesS
But since it's already been established that -exec + is cutting off and starting a new command line every 128 KiB or so, similar to xargs, that's clearly not the issue.

Hold on a second... “128 KiB or so” now is it? Earlier you used 256 as some official size, in the midst of dismissing my comment about 150K as being above the threshold. And now we're saying that 128 is what's “already been established” ? smile

The "some official size" is ARG_MAX, which is 256 * 1024 bytes, or 256 KiB. It is well-known, and documented in /usr/include/sys/syslimits.h. If you don't have the developer tools installed, you can also use the sysctl tool to look it up. 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.

By the way, I went through the source code to the find tool with a debugger, found the problem, and I think I've fixed it. As expected, it had nothing to do with the inputs given to the program except to the extent that random chance affected the code paths. The issue was that errno was being checked at the wrong time, thus causing spurious errors to be logged. This is a problem, though, because the code is bailing out as soon as it encounters the false error.

Oh, and it's been in there since Leopard. You probably just haven't noticed it because the conditions weren't just right to cause it.

Here is a build I made of the tool which should (hopefully) solve the issue. A patch has been sent to Apple, so if they accept the patch, then this might be fixed in some future version of OS X.

http://www.charlessoft.com/fixed_find.zip

P.S. The reason the tool is 50 KB is because it is a 64-bit universal binary, and thus contains three binaries — one for x86_64, one for i386, and one for ppc. 50 KB is not large, by the way — even Hello World is 37.2 KB if you compile it as a tri-binary.