NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/38315: make: ?= should resolve LHS



The following reply was made to PR toolchain/38315; it has been noted by GNATS.

From: "Simon J. Gerraty" <sjg%crufty.net@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, 
sjg%crufty.net@localhost
Subject: Re: toolchain/38315: make: ?= should resolve LHS 
Date: Thu, 27 Mar 2008 09:14:36 -0700

 > I am not sure about calling VarFind twice.  What happens in this case:
 
 Revise patch (below) avoids calling VarFind twice,
 but makes no difference to your test case - though what did you
 want/expect in the output? @echo 'V.$$ = ${V.$$}' ?
 
 If I make your test case:
 
 DOLLAR = $$
 LBRACE = {
 RBRACE = }
 V.$ = FOO
 V.$$ = foo
 V.$$${LBRACE}DOLLAR${RBRACE} = bar
 V.${DOLLAR} ?= baz
 
 all:
         @echo '${V.$$}'
 
 gmake outputs 'foo'
 freebsd make outputs ''
 netbsd make (with[out] patch) outputs 'FOO'
 
 Not sure what to do about that one.
 For the original test case
 
 gmake,freebsd make and ours with the patch output 'OK'
 without the patch we get 'bug'
 
 Index: var.c
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/make/var.c,v
 retrieving revision 1.127
 diff -u -p -r1.127 var.c
 --- var.c      15 Feb 2008 21:29:50 -0000      1.127
 +++ var.c      27 Mar 2008 15:53:10 -0000
 @@ -872,9 +872,15 @@ Boolean
  Var_Exists(const char *name, GNode *ctxt)
  {
      Var                 *v;
 +    char          *cp;
  
 -    v = VarFind(name, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);
 -
 +    if ((cp = strchr(name, '$')) != NULL) {
 +      cp = Var_Subst(NULL, name, ctxt, FALSE);
 +    }
 +    v = VarFind(cp ? cp : name, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);
 +    if (cp != NULL) {
 +      free(cp);
 +    }
      if (v == (Var *)NIL) {
        return(FALSE);
      } else {
 


Home | Main Index | Thread Index | Old Index