Module Name:    src
Committed By:   rillig
Date:           Wed Sep 30 05:42:06 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: varmod-l-name-to-value.exp
            varmod-l-name-to-value.mk

Log Message:
make(1): demonstrate bug in evaluation of indirect variable modifiers

Reported by sjg.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
    src/usr.bin/make/unit-tests/varmod-l-name-to-value.exp
cvs rdiff -u -r1.3 -r1.4 \
    src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/varmod-l-name-to-value.exp
diff -u src/usr.bin/make/unit-tests/varmod-l-name-to-value.exp:1.1 src/usr.bin/make/unit-tests/varmod-l-name-to-value.exp:1.2
--- src/usr.bin/make/unit-tests/varmod-l-name-to-value.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varmod-l-name-to-value.exp	Wed Sep 30 05:42:06 2020
@@ -1 +1,4 @@
-exit status 0
+make: "varmod-l-name-to-value.mk" line 34: Malformed conditional (${value:${:UL}} == "")
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1

Index: src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk
diff -u src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk:1.3 src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk:1.4
--- src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk:1.3	Tue Aug 25 22:25:05 2020
+++ src/usr.bin/make/unit-tests/varmod-l-name-to-value.mk	Wed Sep 30 05:42:06 2020
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-l-name-to-value.mk,v 1.3 2020/08/25 22:25:05 rillig Exp $
+# $NetBSD: varmod-l-name-to-value.mk,v 1.4 2020/09/30 05:42:06 rillig Exp $
 #
 # Tests for the :L modifier, which returns the variable name as the new value.
 
@@ -27,5 +27,12 @@
 .error
 .endif
 
+# Between 2020-09-22 (var.c 1.527) and 2020-09-30 (var.c 1.554), there was
+# a bug in the evaluation of variable expression.  Indirect modifiers like
+# this :L did not update the definedness of the enclosing expression.
+# This resulted in a wrong "Malformed variable".
+.if ${value:${:UL}} == ""
+.endif
+
 all:
 	@:;

Reply via email to