diff options
author | Paul Smith <psmith@gnu.org> | 2022-09-08 02:25:20 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-09-08 03:04:15 -0400 |
commit | 7d484017077089ac2642b89da8984ca46a07323d (patch) | |
tree | acd3526e0ecd0a3a860c867c100bddf820dd9f70 /tests | |
parent | 1fc13bf576b82d5e5b64ba94e6306360b340ec4b (diff) | |
download | make-git-7d484017077089ac2642b89da8984ca46a07323d.tar.gz |
[SV 63016] Don't fail exporting to $(shell ...)
The fix for SV 10593 caused recursive expansion errors when exporting
a variable that contains a $(shell ...) invocation. If we see this
type of recursion, ignore it and expand to the empty string rather
than failing.
* src/variable.h (env_recursion): New global variable.
* src/variable.c (target_environment): If creating the environment
for a $(shell ...) function increment env_recursion. Remove the
check for expansion in a shell function context.
* src/expand.c (recursively_expand_for_file): Check for recursive
expansion in a $(shell ...) environment context and if present,
show the verbose message and return the empty string.
* tests/scripts/functions/shell: Add a test for this situation.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scripts/functions/shell | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/scripts/functions/shell b/tests/scripts/functions/shell index 1ca1e9ab..a5bd5ddc 100644 --- a/tests/scripts/functions/shell +++ b/tests/scripts/functions/shell @@ -88,6 +88,16 @@ all: ; @echo $$HI $(bad) ', '',"hi hi"); +# SV 63016: Exported variable that contains a variable containing $(shell...) + +run_make_test(' +HI = $(shell echo hi) +export bad = $(HI) +.PHONY: all +all:; : $(HI) +', + '',": hi"); + if ($port_type ne 'W32') { # Test shell errors in recipes including offset # This needs to be ported to Windows, or else Windows error messages |