Module Name: src Committed By: rillig Date: Sun Nov 1 10:56:08 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: moderrs.exp moderrs.mk Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/moderrs.exp cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/unit-tests/moderrs.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/moderrs.exp diff -u src/usr.bin/make/unit-tests/moderrs.exp:1.21 src/usr.bin/make/unit-tests/moderrs.exp:1.22 --- src/usr.bin/make/unit-tests/moderrs.exp:1.21 Sun Nov 1 10:53:58 2020 +++ src/usr.bin/make/unit-tests/moderrs.exp Sun Nov 1 10:56:08 2020 @@ -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 Index: src/usr.bin/make/unit-tests/moderrs.mk diff -u src/usr.bin/make/unit-tests/moderrs.mk:1.22 src/usr.bin/make/unit-tests/moderrs.mk:1.23 --- src/usr.bin/make/unit-tests/moderrs.mk:1.22 Sun Nov 1 10:53:58 2020 +++ src/usr.bin/make/unit-tests/moderrs.mk Sun Nov 1 10:56:08 2020 @@ -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 @@ all: mod-sysv-parse 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 @@ mod-regex-delimiter: print-header print- # 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