On 10/27/2010 08:42 AM, Markus Duft wrote:
> On 10/23/2010 01:52 PM, James Youngman wrote:
>> Thanks.   I adopted a very slightly different approach, see
>> https://savannah.gnu.org/bugs/index.php?31424
>>
>> The updated code is already pushed.
> 
> The patch works as expected, thank you very much - this was really painless ;)

owh - spoke too soon. there is no more problem with the too long argument list,
but unfortunately, i now get "xargs: environment is too large for exec" all over
the place (not always, but in situations with increased environment :))

i looked a little into the code, and it seems that the environment block size is
compared to the argument max size (which now is rather small on interix)...
why is this done? 

any ideas how to work around/fix this? in the meantime, i extended the already
pushed patch for my local findutils to additionally re-define ARG_MAX to 50000,
and things return back to a working state :) AFAIK, the maximum environment size
on interix is 32K, if that's of any interest to you...

markus

> 
> markus
> 
>>
>> James.
>>
> 
> 

diff -ru findutils-4.5.9.orig/lib/arg-max.h findutils-4.5.9/lib/arg-max.h
--- findutils-4.5.9.orig/lib/arg-max.h	2010-10-27 14:00:12 +0200
+++ findutils-4.5.9/lib/arg-max.h	2010-10-27 14:07:01 +0200
@@ -28,6 +28,11 @@
  * actually does not work (i.e. it is larger than the real limit).
  * The value of ARG_MAX is reportedly smaller than the real limit.
  *
+ * Unfortunately, ARG_MAX is not sufficient, and not anywhere near
+ * the real limit. by trial and error, the limit on all interix
+ * versions seems to be somewhere near (above) 50K. so we use this
+ * value, instead of relying on any of the broken defines...
+ *
  * I considered a configure test for this which allocates an argument
  * list longer than ARG_MAX but shorter than _SC_ARG_MAX and then
  * tries to exec something, but this will not work for us when
@@ -44,6 +49,10 @@
  */
 # undef _SC_ARG_MAX
 # define BC_SC_ARG_MAX_IS_UNRELIABLE 1
+
+# undef ARG_MAX
+# define ARG_MAX 50000
+
 #endif
 
 #endif

Reply via email to