From owner-freebsd-bugs Tue Jun 2 04:40:38 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA08906 for freebsd-bugs-outgoing; Tue, 2 Jun 1998 04:40:38 -0700 (PDT) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA08892 for ; Tue, 2 Jun 1998 04:40:33 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id EAA17052; Tue, 2 Jun 1998 04:40:01 -0700 (PDT) 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 ; 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 X-Send-Pr-Version: 3.2 Subject: bin/6830: make(1) exhibits confusing and non-standard behaviour Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 6830 >Category: bin >Synopsis: make(1) exhibits confusing and non-standard behaviour >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Jun 2 04:40:01 PDT 1998 >Last-Modified: >Originator: njs3@doc.ic.ac.uk >Organization: >Release: FreeBSD 2.2.5-RELEASE i386 >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. >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message