From owner-freebsd-bugs Fri Jan 18 17:10:12 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id CD6C337B41A for ; Fri, 18 Jan 2002 17:10:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0J1A2S99157; Fri, 18 Jan 2002 17:10:02 -0800 (PST) (envelope-from gnats) Date: Fri, 18 Jan 2002 17:10:02 -0800 (PST) Message-Id: <200201190110.g0J1A2S99157@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Alan Eldridge Subject: Re: bin/34032: make fails to evaluate some reasonable conditional expressions Reply-To: Alan Eldridge Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/34032; it has been noted by GNATS. From: Alan Eldridge To: "Crist J . Clark" Cc: Alan Eldridge , FreeBSD-gnats-submit@FreeBSD.ORG, sobomax@FreeBSD.ORG Subject: Re: bin/34032: make fails to evaluate some reasonable conditional expressions Date: Fri, 18 Jan 2002 20:06:07 -0500 On Fri, Jan 18, 2002 at 01:53:02PM -0800, Crist J . Clark wrote: >In this case, make(1) should never be evauating the "broken" >code. Since the Makefile syntax of the conditional as a whole is OK, >provided you don't actually try to evaluate it, I would expect this to >work. Yup. It should. If we look at cond.c, we see that it still parses the rest of the conditional to eat it, in case it's embedded in a larger test. The real problem occurs in var.c. Down at the end, when Var_Parse() is cleaning up (lines 2269-2288), it basically says: if (var flags & JUNK) { // not in symbol tables if (built-in dynamic var like .CURRENT) { handle this case } else { str = var_Error } } return str The problem is that Var_Parse() is passed a flag telling whether or not to complain about undefined vars -- a value called "err". But err is not checked in this last case. So here's the fix: --- var.c.orig Thu Oct 19 00:23:49 2000 +++ var.c Fri Jan 18 19:50:39 2002 @@ -2283,7 +2283,7 @@ str[*lengthPtr] = '\0'; *freePtr = TRUE; } else { - str = var_Error; + str = err ? var_Error : varNoError; } } return (str); -- Alan Eldridge Pmmfmffmmfmp mmmpppppffmpmfpmpppff PmpMpmMpp ppfppp MpfpffmppmppMmpFmmMpm mfpmmmmmfpmpmpppff. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message