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 parsing bugs in...



details:   https://anonhg.NetBSD.org/src/rev/5f49adb6d5ac
branches:  trunk
changeset: 945545:5f49adb6d5ac
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 01 10:56:08 2020 +0000

description:
make(1): demonstrate parsing bugs in test moderrs.mk

When a malformed variable expression is parsed, the remaining part of
the expression is passed unmodified to the output.  This is unexpected
and wrong.

diffstat:

 usr.bin/make/unit-tests/moderrs.exp |  4 ++--
 usr.bin/make/unit-tests/moderrs.mk  |  9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r 11005814628b -r 5f49adb6d5ac usr.bin/make/unit-tests/moderrs.exp
--- a/usr.bin/make/unit-tests/moderrs.exp       Sun Nov 01 10:53:58 2020 +0000
+++ b/usr.bin/make/unit-tests/moderrs.exp       Sun Nov 01 10:56:08 2020 +0000
@@ -1,12 +1,12 @@
 mod-unknown-direct:
 want: Unknown modifier 'Z'
 make: Unknown modifier 'Z'
-VAR:Z=
+VAR:Z=before--after
 
 mod-unknown-indirect:
 want: Unknown modifier 'Z'
 make: Unknown modifier 'Z'
-VAR:Z=
+VAR:Z=before-inner}-after
 
 unclosed-direct:
 want: Unclosed variable specification (expecting '}') for "VAR" (value "Thevariable") modifier S
diff -r 11005814628b -r 5f49adb6d5ac usr.bin/make/unit-tests/moderrs.mk
--- a/usr.bin/make/unit-tests/moderrs.mk        Sun Nov 01 10:53:58 2020 +0000
+++ b/usr.bin/make/unit-tests/moderrs.mk        Sun Nov 01 10:56:08 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: moderrs.mk,v 1.22 2020/11/01 10:53:58 rillig Exp $
+# $NetBSD: moderrs.mk,v 1.23 2020/11/01 10:56:08 rillig Exp $
 #
 # various modifier error tests
 
@@ -28,11 +28,11 @@
 
 mod-unknown-direct: print-header print-footer
        @echo 'want: Unknown modifier $'Z$''
-       @echo "VAR:Z=${VAR:Z}"
+       @echo 'VAR:Z=before-${VAR:Z}-after'
 
 mod-unknown-indirect: print-header print-footer
        @echo 'want: Unknown modifier $'Z$''
-       @echo "VAR:${MOD_UNKN}=${VAR:${MOD_UNKN}}"
+       @echo 'VAR:${MOD_UNKN}=before-${VAR:${MOD_UNKN}:inner}-after'
 
 unclosed-direct: print-header print-footer
        @echo 'want: Unclosed variable specification (expecting $'}$') for "VAR" (value "Thevariable") modifier S'
@@ -124,7 +124,8 @@
 # syntactical ambiguity since the :S and :C modifiers are open-ended (see
 # mod-subst-chain).  Luckily the modifier :U does not make sense after :C,
 # therefore this case does not happen in practice.
-# The sub-modifier for the :C modifier would have to be chosen wisely.
+# The sub-modifier for the :S and :C modifiers would have to be chosen
+# wisely, to not create ambiguities while parsing.
 mod-regex-undefined-subexpression: print-header print-footer
        @echo ${FIB:C,1(.*),one\1,}             # all ok
        @echo ${FIB:C,1(.*)|2(.*),(\1)+(\2),:Q} # no match for subexpression



Home | Main Index | Thread Index | Old Index