Patch for scan-types.sh, Aix4 grep: max line length exceeded

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Thu Jun 8 12:52:00 GMT 2000


While bootstrapping on powerpc-ibm-aix4.1.4.0, when creating deduced.h
in stage1 I get:

 > [...]
 > /bin/sh ../../egcs-CVS20000607/gcc/scan-types.sh "../../egcs-CVS20000607/gcc" >tmp-deduced.h; \
 >   mv tmp-deduced.h deduced.h; \
 > else \
 >   touch deduced.h; \
 > fi
 > grep: 0652-226 Maximum line length of 2048 exceeded.
 > cat deduced.h ../../egcs-CVS20000607/gcc/sys-protos.h > tmp-fixtmp.c

I tracked this down to a variable which contained "char *" was echo'ed
unprotected through grep and filename expansion in the gcc dir
resulted in a boatload of files.  That overflowed the grep line buffer
on aix4.

The following patch fixed it.  Tested by running fixproto on aix4.
Okay to install?

		--Kaveh



2000-06-08  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* scan-types.sh (VALUE) Wrap use with double quotes to protect
	variable against filename expansion when it contains "char *".

diff -rup orig/egcs-CVS20000607/gcc/scan-types.sh egcs-CVS20000607/gcc/scan-types.sh
--- orig/egcs-CVS20000607/gcc/scan-types.sh	Wed Dec 16 15:58:08 1998
+++ egcs-CVS20000607/gcc/scan-types.sh	Thu Jun  8 15:26:08 2000
@@ -51,7 +51,10 @@ for TYPE in dev_t clock_t fpos_t gid_t i
             eval "VALUE='`${SED} -e 's| *$||' -e '2,$d' <TMP`'"
 	    # Unless VALUE contains a blank, look for a typedef for it
 	    # in turn (this could be a loop, but that would be over-kill).
-	    if echo $VALUE | grep " " >/dev/null ; then true
+	    # Ensure $VALUE is double quoted to protect cases where it
+	    # contains an asterisk and would cause filename expansion.
+	    # E.g. when va_list is "char *".
+	    if echo "$VALUE" | grep " " >/dev/null ; then true
 	    else
 		rm -f TMP
 		${SED} -n -e "s|.*typedef[ 	][ 	]*\(.*[^a-zA-Z0-9_]\)${VALUE}[ 	]*;.*|\1|w TMP" <st-dummy.out>/dev/null


More information about the Gcc-patches mailing list