rkww@UUNET.UU.NET (roger willcocks) (09/20/89)
Herewith details of a bug in gnu 'make version 3.48' and it's fix: description: parsing of quoted '#' characters is broken demonstrate by: ----------- Makefile ---------- FOO = hello \\\# there \# everybody \\# comment # another all: echo $(FOO) ------------------------------- which should collapse FOO to 'hello \# there # everybody \' which will then be echoed as 'hello # there' but what you actually get is FOO collapsed to 'hello \ there everybody \\' which is echoed as 'hello there everybody \' impact: you can't put a '#' character into a variable. solution: The problem is in 'collapse_line' - here's the fix: *** make.c Thu Apr 27 02:04:51 1989 --- make.c.NEW Tue Sep 19 21:15:20 1989 *************** *** 1253,1265 **** if (!backslash) { /* Cut off the line at the #. */ ! *p = '\0'; break; } /* strcpy better copy left to right. */ ! line = p + 1; ! strcpy (p2 + 1 + bs_write, line); } } --- 1253,1265 ---- if (!backslash) { /* Cut off the line at the #. */ ! *(p2 + 1 + bs_write) = '\0'; break; } /* strcpy better copy left to right. */ ! line = p2 + 1 + bs_write + 1; ! strcpy (line - 1, p); } } ---------------------------------- Incidentally, should FOO = echo '\# a comment' >> Makedepend require a backslash before the '#' ? (comment characters shouldn't really be recognised within strings ). Roger Willcocks 'If it all worked, we wouldn't have a job' Crosfield Electronics Ltd Hemel Hempstead, England rkww@cel.uucp +44 442 230000 mcvax!cel!rkww@uunet.uu.net