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): add test for off-by-one err...
details: https://anonhg.NetBSD.org/src/rev/ec1c9b207a5b
branches: trunk
changeset: 936438:ec1c9b207a5b
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jul 26 22:15:36 2020 +0000
description:
make(1): add test for off-by-one error in Var_Parse
diffstat:
distrib/sets/lists/tests/mi | 4 +++-
usr.bin/make/unit-tests/Makefile | 3 ++-
usr.bin/make/unit-tests/varparse-dynamic.exp | 4 ++++
usr.bin/make/unit-tests/varparse-dynamic.mk | 14 ++++++++++++++
4 files changed, 23 insertions(+), 2 deletions(-)
diffs (61 lines):
diff -r 0642ca21bea7 -r ec1c9b207a5b distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi Sun Jul 26 21:47:16 2020 +0000
+++ b/distrib/sets/lists/tests/mi Sun Jul 26 22:15:36 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.877 2020/07/26 14:22:22 riastradh Exp $
+# $NetBSD: mi,v 1.878 2020/07/26 22:15:36 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -4608,6 +4608,8 @@
./usr/tests/usr.bin/make/unit-tests/varmisc.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varmod-edge.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varmod-edge.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.exp tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/varparse-dynamic.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varquote.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varquote.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/varshell.exp tests-usr.bin-tests compattestfile,atf
diff -r 0642ca21bea7 -r ec1c9b207a5b usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Sun Jul 26 21:47:16 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile Sun Jul 26 22:15:36 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.65 2020/07/26 11:10:29 rillig Exp $
+# $NetBSD: Makefile,v 1.66 2020/07/26 22:15:36 rillig Exp $
#
# Unit tests for make(1)
#
@@ -72,6 +72,7 @@
TESTS+= varfind
TESTS+= varmisc
TESTS+= varmod-edge
+TESTS+= varparse-dynamic
TESTS+= varquote
TESTS+= varshell
diff -r 0642ca21bea7 -r ec1c9b207a5b usr.bin/make/unit-tests/varparse-dynamic.exp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varparse-dynamic.exp Sun Jul 26 22:15:36 2020 +0000
@@ -0,0 +1,4 @@
+make: "varparse-dynamic.mk" line 10: Malformed conditional (${.TARGXX})
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r 0642ca21bea7 -r ec1c9b207a5b usr.bin/make/unit-tests/varparse-dynamic.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/varparse-dynamic.mk Sun Jul 26 22:15:36 2020 +0000
@@ -0,0 +1,14 @@
+# $NetBSD: varparse-dynamic.mk,v 1.1 2020/07/26 22:15:36 rillig Exp $
+
+# Before 2020-07-27, there was an off-by-one error in Var_Parse that skipped
+# the last character in the variable name.
+# To trigger the bug, the variable must not be defined.
+.if ${.TARGET} # exact match, may be undefined
+.endif
+.if ${.TARGEX} # 1 character difference, must be defined
+.endif
+.if ${.TARGXX} # 2 characters difference, must be defined
+.endif
+
+all:
+ @:
Home |
Main Index |
Thread Index |
Old Index