Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make/unit-tests make(1): demonstrate another uninten...



details:   https://anonhg.NetBSD.org/src/rev/5623b87a7f0f
branches:  trunk
changeset: 935412:5623b87a7f0f
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Jul 02 12:37:18 2020 +0000

description:
make(1): demonstrate another unintended variable evaluation

diffstat:

 usr.bin/make/unit-tests/cond-short.exp |   1 +
 usr.bin/make/unit-tests/cond-short.mk  |  10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r 866ff7074943 -r 5623b87a7f0f usr.bin/make/unit-tests/cond-short.exp
--- a/usr.bin/make/unit-tests/cond-short.exp    Thu Jul 02 12:34:30 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-short.exp    Thu Jul 02 12:37:18 2020 +0000
@@ -3,6 +3,7 @@
 expected and empty
 expected U23 condition
 expected VAR23
+unexpected M pattern
 expected or
 expected or exists
 expected or empty
diff -r 866ff7074943 -r 5623b87a7f0f usr.bin/make/unit-tests/cond-short.mk
--- a/usr.bin/make/unit-tests/cond-short.mk     Thu Jul 02 12:34:30 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-short.mk     Thu Jul 02 12:37:18 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-short.mk,v 1.3 2020/07/02 10:36:58 rillig Exp $
+# $NetBSD: cond-short.mk,v 1.4 2020/07/02 12:37:18 rillig Exp $
 #
 # Demonstrates that in conditions, the right-hand side of an && or ||
 # is only evaluated if it can actually influence the result.
@@ -27,8 +27,8 @@
 .if 1 && empty(${echo "expected and empty" 1>&2 :L:sh})
 .endif
 
-# FIXME: "VAR U11" must not be evaluated.
-# The whole !empty condition must only be parsed and then discarded.
+# "VAR U11" is not evaluated; it was evaluated before 2020-07-02.
+# The whole !empty condition is only parsed and then discarded.
 VAR=   ${VAR${:U11${echo "unexpected VAR U11" 1>&2 :L:sh}}}
 VAR13= ${VAR${:U12${echo "unexpected VAR13" 1>&2 :L:sh}}}
 .if 0 && !empty(VAR${:U13${echo "unexpected U13 condition" 1>&2 :L:sh}})
@@ -39,6 +39,10 @@
 .if 1 && !empty(VAR${:U23${echo   "expected U23 condition" 1>&2 :L:sh}})
 .endif
 
+# FIXME: The :M modifier must only be parsed, not evaluated.
+.if 0 && !empty(VAR:M${:U${echo "unexpected M pattern" 1>&2 :L:sh}})
+.endif
+
 # The || operator.
 
 .if 1 || ${echo "unexpected or" 1>&2 :L:sh}



Home | Main Index | Thread Index | Old Index