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): document 20-year-old bug in...



details:   https://anonhg.NetBSD.org/src/rev/7f76838949d1
branches:  trunk
changeset: 957111:7f76838949d1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Nov 17 20:08:09 2020 +0000

description:
make(1): document 20-year-old bug in the :!cmd! modifier

diffstat:

 usr.bin/make/unit-tests/varmod-shell.exp |   2 ++
 usr.bin/make/unit-tests/varmod-shell.mk  |  28 ++++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r 000f5f31eab4 -r 7f76838949d1 usr.bin/make/unit-tests/varmod-shell.exp
--- a/usr.bin/make/unit-tests/varmod-shell.exp  Tue Nov 17 19:56:42 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-shell.exp  Tue Nov 17 20:08:09 2020 +0000
@@ -1,1 +1,3 @@
+make: "" returned non-zero status
+make: "previous value" returned non-zero status
 exit status 0
diff -r 000f5f31eab4 -r 7f76838949d1 usr.bin/make/unit-tests/varmod-shell.mk
--- a/usr.bin/make/unit-tests/varmod-shell.mk   Tue Nov 17 19:56:42 2020 +0000
+++ b/usr.bin/make/unit-tests/varmod-shell.mk   Tue Nov 17 20:08:09 2020 +0000
@@ -1,11 +1,35 @@
-# $NetBSD: varmod-shell.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: varmod-shell.mk,v 1.4 2020/11/17 20:08:09 rillig Exp $
 #
 # Tests for the :sh variable modifier, which runs the shell command
 # given by the variable value and returns its output.
 #
-# TODO: Since when is this modifier available?
+# This modifier has been added on 2000-04-29.
+#
+# See also:
+#      ApplyModifier_ShellCommand
 
 # TODO: Implementation
 
+# The command to be run is enclosed between exclamation marks.
+# The previous value of the expression is irrelevant for this modifier.
+# The :!cmd! modifier turns an undefined expression into a defined one.
+.if ${:!echo word!} != "word"
+.  error
+.endif
+
+# If the command exits with non-zero, an error message is printed.
+# XXX: Processing continues as usual though.
+#
+# Since 2000-04-29, the error message mentions the previous
+# value of the expression (which is usually an empty string) instead of the
+# command that was executed.  It's strange that such a simple bug could
+# survive such a long time.
+.if ${:!echo word; false!} != "word"
+.  error
+.endif
+.if ${:Uprevious value:!echo word; false!} != "word"
+.  error
+.endif
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index