From 60905a8afb012aa38ac6d56cee24754cc678947c Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Fri, 6 Sep 2019 22:24:46 -0400 Subject: [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 | 1 + 1 file changed, 1 insertion(+) (limited to 'bootstrap.conf') diff --git a/bootstrap.conf b/bootstrap.conf index 8265660c..5e1d538e 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -46,6 +46,7 @@ gnulib_files=doc/make-stds.texi gnulib_modules="\ alloca fdl +findprog-in getloadavg host-cpu-c-abi strerror -- cgit v1.2.1