]> git.ipfire.org Git - thirdparty/make.git/commit
[SV 10593] Export variables to $(shell ...) commands
authorPaul Smith <psmith@gnu.org>
Sun, 19 Jun 2022 00:25:30 +0000 (20:25 -0400)
committerPaul Smith <psmith@gnu.org>
Sat, 9 Jul 2022 14:44:21 +0000 (10:44 -0400)
commit98da874c43035a490cdca81331724f233a3d0c9a
tree1894a4e883fd03ff762dfcfe4357cf1d68de483f
parent88d6c22a487cc45b6d615d5c055ced5c9d5cb56d
[SV 10593] Export variables to $(shell ...) commands

Export all variables, including exported makefile variables, when
invoking a shell for the $(shell ...) function.  If we detect a
recursive variable expansion, silently ignore that variable and do
not export it.  We do print a debug message.

* NEWS: Announce the potential backward-incompatibility.
* doc/make.texi (Shell Function): Document the export behavior.
* src/main.c (main): Add "shell-export" to .FEATURES.
* src/job.h: New function to free struct childbase.
* src/job.c (free_childbase): Implement it; call from free_child.
* src/function.c (func_shell_base): Use target_environment() to
obtain the proper environment for the shell function.
Use free_childbase() to free memory.
(windows32_openpipe): Don't reset the environment: the caller
already provided a proper PATH variable in envp.
* src/variable.c (target_environment): If we detect a recursive
expansion and we're called from func_shell, ignore the variable.
(sync_Path_environment): Simplify and reduce memory allocation.
* tests/scripts/functions/shell: Add tests for this.
NEWS
doc/make.texi
src/function.c
src/job.c
src/job.h
src/main.c
src/variable.c
tests/scripts/functions/shell