From nsmart@www.in-design.com  Tue Jun  2 04:32:49 1998
Received: from www.in-design.com (www.in-design.com [206.210.93.16])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA07665
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 2 Jun 1998 04:32:48 -0700 (PDT)
          (envelope-from nsmart@www.in-design.com)
Received: (from nsmart@localhost)
	by www.in-design.com (8.8.7/8.8.5) id HAA05318;
	Tue, 2 Jun 1998 07:32:48 -0400 (EDT)
Message-Id: <199806021132.HAA05318@www.in-design.com>
Date: Tue, 2 Jun 1998 07:32:48 -0400 (EDT)
From: njs3@doc.ic.ac.uk
Reply-To: njs3@doc.ic.ac.uk
To: FreeBSD-gnats-submit@freebsd.org
Subject: make(1) exhibits confusing and non-standard behaviour
X-Send-Pr-Version: 3.2

>Number:         6830
>Category:       bin
>Synopsis:       make(1) exhibits confusing and non-standard behaviour
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun  2 04:40:01 PDT 1998
>Closed-Date:    Wed Jul 17 19:27:08 PDT 2002
>Last-Modified:  Wed Jul 17 19:27:08 PDT 2002
>Originator:     njs3@doc.ic.ac.uk
>Release:        FreeBSD 2.2.5-RELEASE i386
>Organization:
>Environment:

>Description:

The := operator is used to force expansion of all variables on the RHS
of the operator, for example:

FOO     = bar
BAR     = ${FOO}
all:
 	echo ${BAR}
FOO     = feh

"make all" will echo "feh" since BAR is assigned ${FOO} and not the
contents of ${FOO} on line 2, and the last value assigned to FOO is "feh".
By using the := operator we can force ${FOO} to be expanded at the
point of assignment:

FOO     = bar
BAR     := ${FOO}
all:
 	echo ${BAR}
FOO     = feh

"make all" will echo "bar" in this case.  However, consider:

BAR     := ${FOO}
all:
 	echo ${BAR}
FOO     = feh

Contrary to the intuitive behaviour and all other implementation of
make, line one assigns ${FOO} to BAR and not the empty string.  This is
a bug, ${FOO} is a variable reference to an undefined variable which
by definition expands to the empty string.  However FreeBSD make does
not honor this behaviour and so "make all" prints "feh" instead of just
echoing a blank line.  Even more confusing is that:

FOO     =
BAR     := ${FOO}
all:
 	echo ${BAR}
FOO     = feh

behaves as expected, because FOO is defined to the empty string.

>How-To-Repeat:

>Fix:
	
I do not have time to provide a patch right now.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->suspended 
State-Changed-By: phk 
State-Changed-When: Sat Jun 6 02:21:18 PDT 1998 
State-Changed-Why:  
awaiting patch & committer 

From: hoek@FreeBSD.org
To: freebsd-gnats-submit@FreeBSD.org, njs3@doc.ic.ac.uk
Cc:  
Subject: Re: bin/6830: make(1) exhibits confusing and non-standard behaviour
Date: Sun, 4 Jul 1999 15:05:58 -0400 (EDT)

 >BAR     := ${FOO}
 >all:
 >        echo ${BAR}
 >FOO     = feh
 >
 >Contrary to the intuitive behaviour and all other implementation of
 >make, line one assigns ${FOO} to BAR and not the empty string.  This is
 >a bug, ${FOO} is a variable reference to an undefined variable which
 >by definition expands to the empty string.
 
 This is intentional: see the comment in parse.c, Parse_DoVar().
 
 Perhaps add a compatibility flag?  Changing the behaviour of make seems
 a little dangerous, given that the current behavious is intended.  OTOH,
 the argument advanced in the afore-mentioned comment is questionable.
 
 Anyways, if the PR stays open for too long, it can just be closed with
 a note stating that the behaviour is intentional.
 
Responsible-Changed-From-To: freebsd-bugs->will 
Responsible-Changed-By: will 
Responsible-Changed-When: Fri Sep 29 13:42:49 PDT 2000 
Responsible-Changed-Why:  
Over to MAINTAINER. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=6830 
Responsible-Changed-From-To: will->freebsd-bugs 
Responsible-Changed-By: will 
Responsible-Changed-When: Wed Aug 29 16:24:51 PDT 2001 
Responsible-Changed-Why:  
I don't have time for make(1) anymore... 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=6830 
State-Changed-From-To: suspended->closed 
State-Changed-By: jmallett 
State-Changed-When: Wed Jul 17 19:26:33 PDT 2002 
State-Changed-Why:  
This PR has been open for too long, and the behaviour is intended. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=6830 
>Unformatted:
