On 10/22/2010 03:30 PM, Markus Duft wrote: > Hey :) > [snip] > It seems that max argument length is too high... > > Now, i'm pretty aware that interix is doing _many_ things wrong, and > sysconf(_SC_ARG_MAX) may well return a much too high number, but to > consistently handle such cases, would it be wise to cap the max argument > length to a sane value in xargs?
answering my own thread, i came up with the attached patch in the meantime, which fixes the problem on interix for now. not sure whether this meats the quality criteria of findutils ;) please tell me, if not. markus > > Thanks, > Markus >
diff -ru -x '*.Po' -x '*.Plo' findutils-4.5.9.orig/lib/buildcmd.c findutils-4.5.9/lib/buildcmd.c --- findutils-4.5.9.orig/lib/buildcmd.c 2010-10-22 15:16:25 +0200 +++ findutils-4.5.9/lib/buildcmd.c 2010-10-22 16:17:02 +0200 @@ -446,7 +446,9 @@ /* XXX: better to do a compile-time check */ assert ( (~(size_t)0) >= LONG_MAX); -#ifdef _SC_ARG_MAX + /* on interix, _SC_ARG_MAX returns 1MB, which is too much. + * ARG_MAX instead is 14500, which works just fine. */ +#if defined(_SC_ARG_MAX) && !defined(__INTERIX) val = sysconf (_SC_ARG_MAX); #else val = -1;