Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make When a var is set in the CMD context, it preven...



details:   https://anonhg.NetBSD.org/src/rev/ab508e281e0b
branches:  trunk
changeset: 787955:ab508e281e0b
user:      sjg <sjg%NetBSD.org@localhost>
date:      Tue Jul 16 20:00:56 2013 +0000

description:
When a var is set in the CMD context, it prevents the same name
being set in GLOBAL context.  We should also delete any such
variable in GLOBAL context, else make -V will show the wrong value.

diffstat:

 usr.bin/make/var.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 03cd3af95cb8 -r ab508e281e0b usr.bin/make/var.c
--- a/usr.bin/make/var.c        Tue Jul 16 19:59:28 2013 +0000
+++ b/usr.bin/make/var.c        Tue Jul 16 20:00:56 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.182 2013/07/16 14:00:53 christos Exp $       */
+/*     $NetBSD: var.c,v 1.183 2013/07/16 20:00:56 sjg Exp $    */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.182 2013/07/16 14:00:53 christos Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.183 2013/07/16 20:00:56 sjg Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.182 2013/07/16 14:00:53 christos Exp $");
+__RCSID("$NetBSD: var.c,v 1.183 2013/07/16 20:00:56 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -929,6 +929,14 @@
     }
     v = VarFind(name, ctxt, 0);
     if (v == NULL) {
+       if (ctxt == VAR_CMD && (flags & VAR_NO_EXPORT) == 0) {
+           /*
+            * This var would normally prevent the same name being added
+            * to VAR_GLOBAL, so delete it from there if needed.
+            * Otherwise -V name may show the wrong value.
+            */
+           Var_Delete(name, VAR_GLOBAL);
+       }
        VarAdd(name, val, ctxt);
     } else {
        Buf_Empty(&v->val);



Home | Main Index | Thread Index | Old Index