Gentle ping... Kind regards, Torbjörn
On 2023-07-05 11:09, Torbjörn SVENSSON wrote:
One way to trigger the error is to set SHELL to a path that contain one space character. To test the behavior, the following can be used: TESTDIR="`mktemp -d '/tmp/make test.XXXXXXXXXX'`" && \ mkdir -p "$TESTDIR" && \ cd "$TESTDIR" && \ ln -s /bin/sh sh && \ echo -e 'all:\n\t@echo "SHELL is $(SHELL)"' > Makefile && \ make SHELL="$TESTDIR/sh" Without the fix: make: /tmp/make: Command not found make: *** [Makefile:2: all] Error 127 With the fix: SHELL is /tmp/make test.o8gS9Mba4b/sh * src/job.c (construct_command_argv_internal): Escape space in $SHELL --- src/job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/job.c b/src/job.c index 1c66090c..0bd3f65c 100644 --- a/src/job.c +++ b/src/job.c @@ -3390,7 +3390,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell, whichever happens first. */ for (cp = shell; *cp != '\0'; ++cp) { - if (strchr (sh_chars, *cp) != 0) + if (strchr (sh_chars, *cp) != 0 || ISSPACE(*cp)) *(ap++) = '\\'; *(ap++) = *cp; }