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: tech-toolchain%netbsd.org@localhost, sjg%crufty.net@localhost
Subject: Re: toolchain/38315: make: ?= should resolve LHS 
Date: Wed, 26 Mar 2008 16:27:35 -0700

 While looking at where to fix this I spotted a few other cases 
 that could bite, so Var_Exists seems the best place to fix;
 
 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      26 Mar 2008 23:20:59 -0000
 @@ -876,10 +876,20 @@ Var_Exists(const char *name, GNode *ctxt
      v = VarFind(name, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);
  
      if (v == (Var *)NIL) {
 +      if (strchr(name, '$') != NULL) {
 +          char *cp;
 +
 +          cp = Var_Subst(NULL, name, ctxt, FALSE);
 +          v = VarFind(cp, ctxt, FIND_CMD|FIND_GLOBAL|FIND_ENV);
 +          free(cp);
 +          if (v != (Var *)NIL) {
 +              goto found;
 +          }
 +      }
        return(FALSE);
 -    } else {
 -      (void)VarFreeEnv(v, TRUE);
      }
 + found:
 +    (void)VarFreeEnv(v, TRUE);
      return(TRUE);
  }
  
 Index: unit-tests/Makefile
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/make/unit-tests/Makefile,v
 retrieving revision 1.21
 diff -u -p -r1.21 Makefile
 --- unit-tests/Makefile        5 Oct 2007 15:27:46 -0000       1.21
 +++ unit-tests/Makefile        26 Mar 2008 23:20:59 -0000
 @@ -31,6 +31,7 @@ SUBFILES= \
        modts \
        modword \
        posix \
 +      qequals \
        ternary \
        varcmd
  
 Index: unit-tests/qequals
 ===================================================================
 RCS file: unit-tests/qequals
 diff -N unit-tests/qequals
 --- /dev/null  1 Jan 1970 00:00:00 -0000
 +++ unit-tests/qequals 26 Mar 2008 23:20:59 -0000
 @@ -0,0 +1,8 @@
 +# $Id$
 +
 +M= i386
 +V.i386= OK
 +V.$M ?= bug
 +
 +all:
 +      @echo 'V.$M ?= ${V.$M}'
 Index: unit-tests/test.exp
 ===================================================================
 RCS file: /cvsroot/src/usr.bin/make/unit-tests/test.exp,v
 retrieving revision 1.21
 diff -u -p -r1.21 test.exp
 --- unit-tests/test.exp        9 Oct 2007 05:55:04 -0000       1.21
 +++ unit-tests/test.exp        26 Mar 2008 23:20:59 -0000
 @@ -286,6 +286,7 @@ a command prefixed by '+' executes even 
  Now we expect an error...
  *** Error code 1 (continuing)
  `all' not remade because of errors.
 +V.i386 ?= OK
  The answer is unknown
  The answer is unknown
  The answer is empty
 


Home | Main Index | Thread Index | Old Index