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(1): error out on unclosed expressions afte...



details:   https://anonhg.NetBSD.org/src/rev/8f6e56a29ec7
branches:  trunk
changeset: 941984:8f6e56a29ec7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Nov 02 20:48:36 2020 +0000

description:
make(1): error out on unclosed expressions after the colon

diffstat:

 usr.bin/make/unit-tests/cmd-errors-lint.exp |   1 +
 usr.bin/make/unit-tests/cmd-errors.exp      |   1 +
 usr.bin/make/var.c                          |  11 +++++++++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r 5408f7bdd2f8 -r 8f6e56a29ec7 usr.bin/make/unit-tests/cmd-errors-lint.exp
--- a/usr.bin/make/unit-tests/cmd-errors-lint.exp       Mon Nov 02 20:43:27 2020 +0000
+++ b/usr.bin/make/unit-tests/cmd-errors-lint.exp       Mon Nov 02 20:48:36 2020 +0000
@@ -1,6 +1,7 @@
 : undefined 
 make: Unclosed variable "UNCLOSED"
 : unclosed-variable 
+make: Unclosed variable expression (expecting '}') for "UNCLOSED"
 : unclosed-modifier 
 make: Unknown modifier 'Z'
 : unknown-modifier 
diff -r 5408f7bdd2f8 -r 8f6e56a29ec7 usr.bin/make/unit-tests/cmd-errors.exp
--- a/usr.bin/make/unit-tests/cmd-errors.exp    Mon Nov 02 20:43:27 2020 +0000
+++ b/usr.bin/make/unit-tests/cmd-errors.exp    Mon Nov 02 20:48:36 2020 +0000
@@ -1,6 +1,7 @@
 : undefined 
 make: Unclosed variable "UNCLOSED"
 : unclosed-variable 
+make: Unclosed variable expression (expecting '}') for "UNCLOSED"
 : unclosed-modifier 
 make: Unknown modifier 'Z'
 : unknown-modifier 
diff -r 5408f7bdd2f8 -r 8f6e56a29ec7 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Mon Nov 02 20:43:27 2020 +0000
+++ b/usr.bin/make/var.c        Mon Nov 02 20:48:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.648 2020/11/02 19:07:09 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.649 2020/11/02 20:48:36 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -130,7 +130,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.648 2020/11/02 19:07:09 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.649 2020/11/02 20:48:36 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -3357,6 +3357,13 @@
     assert(val != NULL);
 
     p = *pp;
+
+    if (*p == '\0' && endc != '\0') {
+       Error("Unclosed variable expression (expecting '%c') for \"%s\"",
+             st.endc, st.v->name);
+       goto cleanup;
+    }
+
     while (*p != '\0' && *p != endc) {
 
        if (*p == '$') {



Home | Main Index | Thread Index | Old Index