]> git.ipfire.org Git - thirdparty/make.git/commit
[SV 56834] Support local PATH search with posix_spawnp
authorPaul Smith <psmith@gnu.org>
Sat, 7 Sep 2019 02:24:46 +0000 (22:24 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 8 Sep 2019 19:12:40 +0000 (15:12 -0400)
commit60905a8afb012aa38ac6d56cee24754cc678947c
tree7ffd8f9802f624bc3ded7e5ab409e8a149de4bd1
parentebe1d371040d4962c0c4add280f70878b3255118
[SV 56834] Support local PATH search with posix_spawnp

When using exec we install the child's environment before invoking
execlp(), so commands are found on the child's PATH.  posix_spawnp
searches on the parent's PATH, which we don't want.

Import gnulib's findprog-in module and use it to search the child's
PATH, then use posix_spawn() to run it.

Also, posix_spawn() does not fall back to trying sh on ENOEXEC, as
execlp() does, so implement that as well.

* bootstrap.conf: Add the findprog-in gnulib module
* src/job.c: Include findprog.h if we're using posix_spawn.
(start_job_command): Remove the handling of child->cmd_name,
(child_execute_job): and add it here.  Look up the command to be
run in the child's path and invoke it if found.  If it fails with
ENOEXEC then retry it as an argument to the default shell.
* tests/scripts/misc/general4: Test makefile PATH assignments.
* tests/scripts/features/targetvars: Ditto, for target variables.
bootstrap.conf
src/job.c
tests/scripts/features/targetvars
tests/scripts/misc/general4