Article View: gnu.utils.bug
Article #431bug in make v3.48 (and fix)
From: roger willcocks
Date: Wed, 20 Sep 1989 13:00
Date: Wed, 20 Sep 1989 13:00
69 lines
2128 bytes
2128 bytes
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
Technical Details
Message-ID:
<8909201300.AA01403@sun9.cel.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!UUNET.UU.NET!cel!rkwwShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!UUNET.UU.NET!cel!rkww From: cel!rkww@UUNET.UU.NET (roger willcocks) Newsgroups: gnu.utils.bug Subject: bug in make v3.48 (and fix) Message-ID: <8909201300.AA01403@sun9.cel.uucp> Date: 20 Sep 89 13:00:52 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 69