Module Name:    src
Committed By:   rillig
Date:           Thu Aug  6 05:36:33 UTC 2020

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/usr.bin/make/unit-tests: Makefile
Added Files:
        src/usr.bin/make/unit-tests: recursive.exp recursive.mk

Log Message:
make(1): add test for unintended "recursive variable" in -dL mode


To generate a diff of this commit:
cvs rdiff -u -r1.884 -r1.885 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.83 -r1.84 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/recursive.exp \
    src/usr.bin/make/unit-tests/recursive.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.884 src/distrib/sets/lists/tests/mi:1.885
--- src/distrib/sets/lists/tests/mi:1.884	Mon Aug  3 15:43:31 2020
+++ src/distrib/sets/lists/tests/mi	Thu Aug  6 05:36:32 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.884 2020/08/03 15:43:31 rillig Exp $
+# $NetBSD: mi,v 1.885 2020/08/06 05:36:32 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4598,6 +4598,8 @@
 ./usr/tests/usr.bin/make/unit-tests/posix1.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/qequals.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/qequals.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/recursive.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/recursive.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suffixes.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/suffixes.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/sunshcmd.exp	tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.83 src/usr.bin/make/unit-tests/Makefile:1.84
--- src/usr.bin/make/unit-tests/Makefile:1.83	Mon Aug  3 15:43:32 2020
+++ src/usr.bin/make/unit-tests/Makefile	Thu Aug  6 05:36:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.83 2020/08/03 15:43:32 rillig Exp $
+# $NetBSD: Makefile,v 1.84 2020/08/06 05:36:33 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -70,6 +70,7 @@ TESTS+=		# phony-end	# broken by reverti
 TESTS+=		posix
 TESTS+=		# posix1	# broken by reverting POSIX changes
 TESTS+=		qequals
+TESTS+=		recursive
 TESTS+=		# suffixes	# broken by reverting POSIX changes
 TESTS+=		sunshcmd
 TESTS+=		sysv
@@ -90,6 +91,7 @@ ENV.counter=		-i
 ENV.envfirst=		FROM_ENV=value-from-env
 ENV.export=		-i PATH=${PATH:Q}
 ENV.lint=		-i
+ENV.recursive=		-i
 ENV.varmisc=		FROM_ENV=env
 ENV.varmisc+=		FROM_ENV_BEFORE=env
 ENV.varmisc+=		FROM_ENV_AFTER=env
@@ -101,6 +103,7 @@ FLAGS.envfirst=		-e
 FLAGS.export=		-r
 FLAGS.lint=		-dL -k
 FLAGS.order=		-j1
+FLAGS.recursive=	-dL
 FLAGS.vardebug=		-k -dv FROM_CMDLINE=
 
 # Some tests need extra post-processing.

Added files:

Index: src/usr.bin/make/unit-tests/recursive.exp
diff -u /dev/null src/usr.bin/make/unit-tests/recursive.exp:1.1
--- /dev/null	Thu Aug  6 05:36:33 2020
+++ src/usr.bin/make/unit-tests/recursive.exp	Thu Aug  6 05:36:33 2020
@@ -0,0 +1,4 @@
+Variable am__v_lt_ is recursive.
+
+make: stopped in unit-tests
+exit status 2
Index: src/usr.bin/make/unit-tests/recursive.mk
diff -u /dev/null src/usr.bin/make/unit-tests/recursive.mk:1.1
--- /dev/null	Thu Aug  6 05:36:33 2020
+++ src/usr.bin/make/unit-tests/recursive.mk	Thu Aug  6 05:36:33 2020
@@ -0,0 +1,22 @@
+# $NetBSD: recursive.mk,v 1.1 2020/08/06 05:36:33 rillig Exp $
+#
+# In -dL mode, a variable may get expanded before it makes sense.
+# This would stop make from doing anything since the "recursive" error
+# is fatal and exits immediately.
+#
+# The purpose of evaluating that variable early was just to detect
+# whether there are unclosed variables.  It might be enough to parse the
+# variable value without VARE_WANTRES for that purpose.
+#
+# Seen in pkgsrc/x11/libXfixes, and probably many more package that use
+# GNU Automake.
+
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+am__v_lt_1 =
+libXfixes_la_LINK = ... $(AM_V_lt) ...
+.info not reached
+
+# somewhere later ...
+AM_DEFAULT_VERBOSITY = 1

Reply via email to