Date: Thu, 21 Feb 2002 15:14:39 -0800 From: Luigi Rizzo <rizzo@icir.org> To: Alfred Perlstein <bright@mu.org> Cc: Bruce Evans <bde@zeta.org.au>, "M. Warner Losh" <imp@village.org>, current@FreeBSD.ORG, msmith@FreeBSD.ORG Subject: Proposed patch for "/bin/sh: Argument list too long" when compiling LINT ... Message-ID: <20020221151439.D53952@iguana.icir.org> In-Reply-To: <20020219085306.GL12136@elvis.mu.org> References: <20020218.174959.96666779.imp@village.org> <20020219193515.Y1320-100000@gamplex.bde.org> <20020219004144.A25474@iguana.icir.org> <20020219085306.GL12136@elvis.mu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
So, in this thread a few days ago i reported that the list of arguments passed to mkdep can become quite large and exceed kern.argmax, especially if your sources are not in the default place and you are compiling a file with lots of options such as LINT. The place to fix (for -current) is sys/conf/kern.post.mk, and as Alfred suggested, a fix involves using xargs (mkdep is already invoked with -a). Unfortunately it is not entirely trivial because the variable containing the argument list is a Make variable, and any attempt to expand it in a command will result in the "Argument list too long" error. The best I could come up with is the following (modulo cut&paste conversion of tabs in spaces), i.e. use make's .for to copy the list of files into a file that we can then pass to xargs. Any better ideas ? cheers luigi Index: kern.post.mk =================================================================== RCS file: /home/ncvs/src/sys/conf/kern.post.mk,v retrieving revision 1.4 diff -u -r1.4 kern.post.mk --- kern.post.mk 2001/11/11 06:16:53 1.4 +++ kern.post.mk 2002/02/21 04:49:26 @@ -89,10 +89,28 @@ ${SYSTEM_SFILES} ${MFILES:T:S/.m$/.h/} if [ -f .olddep ]; then mv .olddep .depend; fi rm -f .newdep - env MKDEP_CPP="${CC} -E" CC="${CC}" \ - mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILE S} - env MKDEP_CPP="${CC} -E" \ - mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES} + # + # The argument list can be very long, and the only way we have to + # split it is within make because anything else will cause + # an exec error if the list is too long! + rm -f .args +.for I in ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} + @echo -n "$I " >> .args +.endfor + echo "" >> .args + echo "args len is " ; wc .args + # argument list... + cat .args | xargs env MKDEP_CPP="${CC} -E" CC="${CC}" \ + mkdep -a -f .newdep ${CFLAGS} + rm -f .args +.for I in ${SFILES} ${SYSTEM_SFILES} + @echo -n "$I " >> .args +.endfor + echo "" >> .args + echo "args len is " ; wc .args + cat .args | xargs env MKDEP_CPP="${CC} -E" \ + mkdep -a -f .newdep ${ASM_CFLAGS} + rm -f .args rm -f .depend mv .newdep .depend To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020221151439.D53952>