🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #469

A problem with <at>D in GNU Make 3.54

#469
From: Tim Bissell
Date: Wed, 04 Oct 1989 10:16
61 lines
2469 bytes
I think I have found a bug in the @D pseudo-variable in GNU Make version 3.54
and below.  It lops the last character off the directory name it produces.  A
script which shows the problem, and a fix, are given below.

---------------------------------------

glider!wys> cat Makefile

.PHONY: foo/bar
foo/bar:
	@echo 'This should be foo ->' $(@D) '<- should it not?'

glider!wys> ../make -v
GNU Make version 3.54, by Richard Stallman and Roland McGrath.
Copyright (C) 1988, 1989 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This should be foo -> fo <- should it not?

---------------------------------------

Here is my fix for what appears to be a simple of-by-one bug.  It seems
to work when I use it but I haven't checked extensively.  Sorry if this
has already been fixed, but 3.54 is the most recent version I have been
able to get hold of.

---------------------------------------

*** commands.c	Fri Sep 29 16:25:11 1989
--- commands.c.~1~	Fri Sep 29 10:17:59 1989
***************
*** 63,69 ****
  #define	LASTSLASH(s)	rindex ((s), '/')
  #define	FILEONLY(s)	(p != 0 ? p + 1 : (s))
  #define	DIRONLY(s)	(p == 0 ? "./" : p == (s) ? "/" \
! 			 : savestring ((s), p - (s) )) /* Removed - 1 */
  
    /* $* is the stem from an implicit or static pattern rule.  */
    if (file->stem == 0)
--- 63,69 ----
  #define	LASTSLASH(s)	rindex ((s), '/')
  #define	FILEONLY(s)	(p != 0 ? p + 1 : (s))
  #define	DIRONLY(s)	(p == 0 ? "./" : p == (s) ? "/" \
! 			 : savestring ((s), p - (s) - 1))
  
    /* $* is the stem from an implicit or static pattern rule.  */
    if (file->stem == 0)

---------------------------------------

Thanks for some wonderful useful products etc. etc.

---------------------------------------

Tim Bissell
( tjb@tadtec.UUCP || {...mcvax!}ukc!tadtec!tjb )
Tadpole Technology plc.
Titan House, Castle Park, Cambridge, England .
Technical Details
Message-ID: <TJB.89Oct4111640@tadtec.uucp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!uflorida!uakari.primate.wisc.edu!ginosko!uunet!mcsun!ukc!tadtec!tjb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!uflorida!uakari.primate.wisc.edu!ginosko!uunet!mcsun!ukc!tadtec!tjb
From: tjb@tadtec.uucp (Tim Bissell)
Newsgroups: gnu.utils.bug
Subject: A problem with <at>D in GNU Make 3.54
Message-ID: <TJB.89Oct4111640@tadtec.uucp>
Date: 4 Oct 89 10:16:44 GMT
Sender: tjb@tadtec.uucp (Tim Bissell)
Distribution: gnu
Organization: Tadpole Technology plc
Lines: 62