Subject: Re: "argument list too long"

From: Stefan Eletzhofer <[email-masked]>
Date: Wed, 04 Jan 2006 14:08:05 +0100

Hi,

Am Dienstag, den 03.01.2006, 15:17 +0100 schrieb Wolfgang Denk:
> In message <[email-masked]> you wrote:
> >
> > After a few minutes of dependency creation, I get the following error
> > "argument list too long":
> > 
> > scripts/mkdep -- `find
> > /usr/src/linuxppc_2_4_devel-2005-10-25-1440/include/asm
> > /usr/src/linuxppc_2_4
> > _devel-2005-10-25-1440/include/linux
> > /usr/src/linuxppc_2_4_devel-2005-10-25-1440/include/scsi /usr/s
> > rc/linuxppc_2_4_devel-2005-10-25-1440/include/net
> > /usr/src/linuxppc_2_4_devel-2005-10-25-1440/includ
> > e/math-emu \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h !
> > -name modversions.h -print`
> >  > .hdepend
> > scripts/mkdep: argument list too long
> > make: *** [dep-files] Error 2
> > 
> > Can someone help me understand where that comes from?
> 
> The error comes from the fact that the  find  command  (the  part  in
> `...`  above)  generates a long list of file names which exceeds some
> buffer in your shell.
> 
> > Does it have something to do with the fact that I work under WinXP + Cygwin?
> 
> Yes.
> 
> > No need to say that I am a newbie to the Linux world... help me, Wolfgang
> > :-)
> 
> I try. Find the statement in the Makefile and use xargs  to  avoid  a
> long argument list. Something like this might help:
> 
> --- Makefile.ORIG	2006-01-03 15:15:48.000000000 +0100
> +++ Makefile	2006-01-03 15:16:55.000000000 +0100
> @@ -503,7 +503,7 @@
>  ifdef CONFIG_MODVERSIONS
>  	$(MAKE) update-modverfile
>  endif
> -	scripts/mkdep -- `find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
> +	find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print | xargs scripts/mkdep -- > .hdepend
>  	scripts/mkdep -- init/*.c > .depend

Would'nt this overwrite .depend if xargs executes mkdep more than once?
I'd suggest (beware, manually hacked diff ;):

--- Makefile.ORIG 2006-01-03 15:15:48.000000000 +0100
+++ Makefile	2006-01-03 15:16:55.000000000 +0100
@@ -503,7 +503,7 @@
 ifdef CONFIG_MODVERSIONS
 	$(MAKE) update-modverfile
 endif
-	scripts/mkdep -- `find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
+	rm -f .depend && find $(FINDHPATH) \( -name SCCS -o -name .svn \) -prune -o -follow -name \*.h ! -name modversions.h -print | xargs scripts/mkdep -- > .hdepend
 	scripts/mkdep -- init/*.c >> .depend

>  ifdef CONFIG_MODVERSIONS
> Best regards,
> Wolfgang Denk
-- 
Stefan Eletzhofer
InQuant GmbH
Bahnhofstraße 11
D-88214 Ravensburg
http://www.inquant.de
http://www.eletztrick.de
+49 (0) 751 35 44 112
+49 (0) 171 23 24 529 (Mobil)
+49 (0) 751 35 44 115 (FAX)