bin/64327: [PATCH] make(1): document surprising behaviour of assign with expansion

Oliver Eikemeier eikemeier at fillmore-labs.com
Tue Mar 16 03:50:12 PST 2004


>Number:         64327
>Category:       bin
>Synopsis:       [PATCH] make(1): document surprising behaviour of assign with expansion
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 16 03:50:11 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 4.9-STABLE

>Description:

Document a surprising behaviour of make(1)s assign with expansion
operator, that is apparently inteded but had bitten my at least once.

>How-To-Repeat:

Try the Makefile from the patch:

VAR1:=	Assigned with${OUT} expansion
VAR2!=	echo Assigned with${OUT} expansion
OUT=	out
all:
	@echo := - ${VAR1}
	@echo != - ${VAR2}

>Fix:

diff -u -r1.29.2.15 make.1
--- make.1	17 Dec 2002 19:01:18 -0000	1.29.2.15
+++ make.1	16 Mar 2004 11:12:09 -0000
@@ -1266,6 +1266,17 @@
 \&.endfor
 .Ed
 won't work, and should be rewritten the other way around.
+.Pp
+Undefined variables are not expanded when assigned with expansion.
+This is intentional, but may lead to surprising results:
+.Bd -literal
+VAR1:=  Assigned with${OUT} expansion
+VAR2!=  echo Assigned with${OUT} expansion
+OUT=    out
+all:
+    @echo := - ${VAR1}
+    @echo != - ${VAR2}
+.Ed
 .Sh SEE ALSO
 .Xr mkdep 1 ,
 .Xr make.conf 5

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list