🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by roger willcocks Wed, 20 Sep 1989 13:00
bug in make v3.48 (and fix)
#431
Author: roger willcocks
Date: Wed, 20 Sep 1989 13:00
69 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads