Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make: do not allow delete of readOnly variable.



details:   https://anonhg.NetBSD.org/src/rev/1e4f82499931
branches:  trunk
changeset: 376414:1e4f82499931
user:      sjg <sjg%NetBSD.org@localhost>
date:      Fri Jun 16 22:30:35 2023 +0000

description:
make: do not allow delete of readOnly variable.

Sometimes we mark a variable readOnly to guard against .undef

diffstat:

 usr.bin/make/var.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 92793b97b1f1 -r 1e4f82499931 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Fri Jun 16 22:18:02 2023 +0000
+++ b/usr.bin/make/var.c        Fri Jun 16 22:30:35 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.1055 2023/06/01 07:44:10 rillig Exp $        */
+/*     $NetBSD: var.c,v 1.1056 2023/06/16 22:30:35 sjg Exp $   */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1055 2023/06/01 07:44:10 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1056 2023/06/16 22:30:35 sjg Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -513,6 +513,11 @@ Var_Delete(GNode *scope, const char *var
 
        DEBUG2(VAR, "%s: delete %s\n", scope->name, varname);
        v = he->value;
+       if (v->readOnly) {
+               DEBUG2(VAR, "%s: delete %s (readOnly)\n",
+                   scope->name, varname);
+               return;
+       }
        if (v->inUse) {
                Parse_Error(PARSE_FATAL,
                    "Cannot delete variable \"%s\" while it is used",



Home | Main Index | Thread Index | Old Index