Tue Nov 17 20:08:09 2020 UTC ()
make(1): document 20-year-old bug in the :!cmd! modifier


(rillig)
diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-shell.exp
diff -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-shell.mk

cvs diff -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-shell.exp (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/varmod-shell.exp 2020/08/16 12:07:51 1.1
+++ src/usr.bin/make/unit-tests/varmod-shell.exp 2020/11/17 20:08:09 1.2

cvs diff -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-shell.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/varmod-shell.mk 2020/11/15 20:20:58 1.3
+++ src/usr.bin/make/unit-tests/varmod-shell.mk 2020/11/17 20:08:09 1.4
@@ -1,11 +1,35 @@ @@ -1,11 +1,35 @@
1# $NetBSD: varmod-shell.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $ 1# $NetBSD: varmod-shell.mk,v 1.4 2020/11/17 20:08:09 rillig Exp $
2# 2#
3# Tests for the :sh variable modifier, which runs the shell command 3# Tests for the :sh variable modifier, which runs the shell command
4# given by the variable value and returns its output. 4# given by the variable value and returns its output.
5# 5#
6# TODO: Since when is this modifier available? 6# This modifier has been added on 2000-04-29.
 7#
 8# See also:
 9# ApplyModifier_ShellCommand
7 10
8# TODO: Implementation 11# TODO: Implementation
9 12
 13# The command to be run is enclosed between exclamation marks.
 14# The previous value of the expression is irrelevant for this modifier.
 15# The :!cmd! modifier turns an undefined expression into a defined one.
 16.if ${:!echo word!} != "word"
 17. error
 18.endif
 19
 20# If the command exits with non-zero, an error message is printed.
 21# XXX: Processing continues as usual though.
 22#
 23# Since 2000-04-29, the error message mentions the previous
 24# value of the expression (which is usually an empty string) instead of the
 25# command that was executed. It's strange that such a simple bug could
 26# survive such a long time.
 27.if ${:!echo word; false!} != "word"
 28. error
 29.endif
 30.if ${:Uprevious value:!echo word; false!} != "word"
 31. error
 32.endif
 33
10all: 34all:
11 @:; 35 @:;