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 .for loop from...



details:   https://anonhg.NetBSD.org/src/rev/ab4c0a38d14c
branches:  trunk
changeset: 938984:ab4c0a38d14c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Sep 22 18:54:50 2020 +0000

description:
make(1): add test for .for loop from PR bin/29985

diffstat:

 usr.bin/make/unit-tests/directive-for.exp |   1 +
 usr.bin/make/unit-tests/directive-for.mk  |  26 +++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletions(-)

diffs (46 lines):

diff -r 5779d09af1ce -r ab4c0a38d14c usr.bin/make/unit-tests/directive-for.exp
--- a/usr.bin/make/unit-tests/directive-for.exp Tue Sep 22 18:07:58 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-for.exp Tue Sep 22 18:54:50 2020 +0000
@@ -1,2 +1,3 @@
 make: "directive-for.mk" line 100: outer
+make: "directive-for.mk" line 125: a:\ a:\file.txt
 exit status 0
diff -r 5779d09af1ce -r ab4c0a38d14c usr.bin/make/unit-tests/directive-for.mk
--- a/usr.bin/make/unit-tests/directive-for.mk  Tue Sep 22 18:07:58 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-for.mk  Tue Sep 22 18:54:50 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for.mk,v 1.3 2020/09/14 18:49:24 rillig Exp $
+# $NetBSD: directive-for.mk,v 1.4 2020/09/22 18:54:51 rillig Exp $
 #
 # Tests for the .for directive.
 
@@ -101,5 +101,29 @@
 .  endfor
 .endfor
 
+# From https://gnats.netbsd.org/29985.
+#
+# Until 2008-12-21, the .for loop was expanded by replacing the variable
+# value literally in the body.  This could lead to situations where the
+# characters from the variable value were interpreted as markup rather than
+# plain text.
+#
+# Until 2012-06-03, the .for loop had split the words at whitespace, without
+# taking quotes into account.  This made it possible to have variable values
+# like "a:\ a:\file.txt" that ended in a single backslash.  Since then, the
+# variable values have been replaced with expressions of the form ${:U...},
+# which are not interpreted as code anymore.
+#
+# As of 2020-09-22, a comment in for.c says that it may be possible to
+# produce an "unwanted substitution", but there is no demonstration code yet.
+#
+# The above changes prevent a backslash at the end of a word from being
+# interpreted as part of the code.  Because of this, the trailingBackslash
+# hack in Var_Subst is no longer needed and as of 2020-09-22, has been
+# removed.
+.for path in a:\ a:\file.txt
+.  info ${path}
+.endfor
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index