Module Name: src Committed By: rillig Date: Tue Nov 17 20:08:09 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: varmod-shell.exp varmod-shell.mk Log Message: make(1): document 20-year-old bug in the :!cmd! modifier To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/varmod-shell.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/unit-tests/varmod-shell.exp diff -u src/usr.bin/make/unit-tests/varmod-shell.exp:1.1 src/usr.bin/make/unit-tests/varmod-shell.exp:1.2 --- src/usr.bin/make/unit-tests/varmod-shell.exp:1.1 Sun Aug 16 12:07:51 2020 +++ src/usr.bin/make/unit-tests/varmod-shell.exp Tue Nov 17 20:08:09 2020 @@ -1 +1,3 @@ +make: "" returned non-zero status +make: "previous value" returned non-zero status exit status 0 Index: src/usr.bin/make/unit-tests/varmod-shell.mk diff -u src/usr.bin/make/unit-tests/varmod-shell.mk:1.3 src/usr.bin/make/unit-tests/varmod-shell.mk:1.4 --- src/usr.bin/make/unit-tests/varmod-shell.mk:1.3 Sun Nov 15 20:20:58 2020 +++ src/usr.bin/make/unit-tests/varmod-shell.mk Tue Nov 17 20:08:09 2020 @@ -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: @:;