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): explain the purpose of the ...
details: https://anonhg.NetBSD.org/src/rev/9607f6efca98
branches: trunk
changeset: 1014781:9607f6efca98
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Oct 03 09:48:40 2020 +0000
description:
make(1): explain the purpose of the test make-exported
diffstat:
usr.bin/make/unit-tests/make-exported.exp | 2 +-
usr.bin/make/unit-tests/make-exported.mk | 23 ++++++++++++++++++-----
2 files changed, 19 insertions(+), 6 deletions(-)
diffs (46 lines):
diff -r e944ee50c21f -r 9607f6efca98 usr.bin/make/unit-tests/make-exported.exp
--- a/usr.bin/make/unit-tests/make-exported.exp Sat Oct 03 09:37:04 2020 +0000
+++ b/usr.bin/make/unit-tests/make-exported.exp Sat Oct 03 09:48:40 2020 +0000
@@ -1,3 +1,3 @@
--literal=make-exported-value
+-literal=make-exported-value-literal
UT_VAR=
exit status 0
diff -r e944ee50c21f -r 9607f6efca98 usr.bin/make/unit-tests/make-exported.mk
--- a/usr.bin/make/unit-tests/make-exported.mk Sat Oct 03 09:37:04 2020 +0000
+++ b/usr.bin/make/unit-tests/make-exported.mk Sat Oct 03 09:48:40 2020 +0000
@@ -1,16 +1,29 @@
-# $NetBSD: make-exported.mk,v 1.1 2020/08/09 12:59:16 rillig Exp $
+# $NetBSD: make-exported.mk,v 1.2 2020/10/03 09:48:40 rillig Exp $
#
# As of 2020-08-09, the code in Var_Export is shared between the .export
# directive and the .MAKE.EXPORTED variable. This leads to non-obvious
# behavior for certain variable assignments.
--env= make-exported-value
--literal= make-exported-value
+-env= make-exported-value-env
+-literal= make-exported-value-literal
UT_VAR= ${UNEXPANDED}
# The following behavior is probably not intended.
-.MAKE.EXPORTED= -env # like .export-env
-.MAKE.EXPORTED= -literal UT_VAR # like .export-literal PATH
+.MAKE.EXPORTED= -env # behaves like .export-env
+
+# If the value of .MAKE.EXPORTED starts with "-literal", make behaves like
+# a mixture of .export-literal and a regular .export.
+# XXX: This is due to a sloppy implementation, reusing code in places where
+# it is not appropriate.
+#
+# In Parse_DoVar, the code path for MAKE_EXPORTED is taken, calling Var_Export
+# in turn. There, the code path for .export-literal is taken, and the
+# environment variable UT_VAR is set to ${UNEXPANDED}, as expected.
+# Later, in Compat_RunCommand, in the child process after vfork,
+# Var_ExportVars is called, which treats "-literal" as an ordinary variable
+# name, therefore exports it and also overwrites the previously exported
+# UT_VAR with the expanded value.
+.MAKE.EXPORTED= -literal UT_VAR
all:
@env | sort | grep -E '^UT_|make-exported-value' || true
Home |
Main Index |
Thread Index |
Old Index