Module Name: src
Committed By: rillig
Date: Fri Oct 30 08:13:17 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: cond-cmp-string.exp cond-cmp-string.mk
Log Message:
make(1): demonstrate parse error in string interpolation in condition
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/cond-cmp-string.exp
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-cmp-string.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/cond-cmp-string.exp
diff -u src/usr.bin/make/unit-tests/cond-cmp-string.exp:1.4 src/usr.bin/make/unit-tests/cond-cmp-string.exp:1.5
--- src/usr.bin/make/unit-tests/cond-cmp-string.exp:1.4 Sat Sep 12 10:39:34 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-string.exp Fri Oct 30 08:13:17 2020
@@ -3,6 +3,7 @@ make: "cond-cmp-string.mk" line 37: Malf
make: "cond-cmp-string.mk" line 42: warning: String comparison operator must be either == or !=
make: "cond-cmp-string.mk" line 42: Malformed conditional (!("value" = "value"))
make: "cond-cmp-string.mk" line 49: Malformed conditional (!("value" === "value"))
+make: "cond-cmp-string.mk" line 63: Malformed conditional (${:Uword} != "${:Uword} ")
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
Index: src/usr.bin/make/unit-tests/cond-cmp-string.mk
diff -u src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.6 src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.7
--- src/usr.bin/make/unit-tests/cond-cmp-string.mk:1.6 Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/cond-cmp-string.mk Fri Oct 30 08:13:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: cond-cmp-string.mk,v 1.6 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: cond-cmp-string.mk,v 1.7 2020/10/30 08:13:17 rillig Exp $
#
# Tests for string comparisons in .if conditions.
@@ -52,3 +52,22 @@
. error
.endif
+# A variable expression can be enclosed in double quotes.
+.if ${:Uword} != "${:Uword}"
+. error
+.endif
+
+# XXX: As of 2020-10-30, adding a space to the string results in a parse
+# error. This is a bug and should have been caught much earlier.
+# I wonder since when it exists.
+.if ${:Uword} != "${:Uword} "
+. error
+.else
+. error
+.endif
+
+# Adding a space at the beginning of the quoted variable expression works
+# though.
+.if ${:U word } != " ${:Uword} "
+. error
+.endif