Description of problem: make 3.81 differs in how it treats multi-line statements depending on whether or not the SHELL is specified. It didn't do this in 3.80. Version-Release number of selected component (if applicable): make-3.81-1.1 How reproducible: Always Steps to Reproduce: 1. Use the attached Makefile 2. make 3. Un-comment the first line 4. make Actual results: First run: for i in one two three; do \ echo $i; \ done one two three Second run: for i in one two three; do \ echo $i; \ done /bin/sh: -c: line 1: syntax error: unexpected end of file /bin/sh: line 1: echo $i; \: command not found /bin/sh: -c: line 2: syntax error near unexpected token `done' /bin/sh: -c: line 2: `done' make: *** [all] Error 2 Expected results: Same both times, no syntax error Additional info: Since the docs say that when SHELL is not set, /bin/sh is used, I wouldn't expect a difference. Indeed, the docs say that every Makefile should set the SHELL to /bin/sh (section 14.1, "General Conventions for Makefiles"). However, tracing shows that when SHELL is set, make invokes an extra shell like this: /bin/sh -c "\"/bin/sh\" -c for\\ i\\ in\\ one\\ two\\ three\\;\\ do\\ \\\\\n..." That part hasn't changed since 3.80, though. What has changed is the treatment of line-ends. The newlines are passed without quoting them, so they are interpreted by the outer shell instead of the inner shell. The inner shell only ever gets the first line of the command; the outer shell gets the rest of the lines as quoted strings and thus usually can't execute them. Eliminating the double shell would fix this in the case that SHELL=/bin/sh. However, single-quoting the newlines might also fix it: /bin/sh -c "\"/bin/sh\" -c for\\ i\\ in\\ one\\ two\\ three\\;\\ do\\ \\\\'\n'..." The Makefile mentioned above, which I'll also try to attach, is as follows: #SHELL="/bin/sh" all: for i in one two three; do \ echo $$i; \ done
Created attachment 143470 [details] a Makefile showing the problem
Confirmed. Didn't find anything relevant in documentation. Didn't find related bug upstream, only several bugs with backshlash-eol handling. The problem arises when shell program, or any of its arguments, contain non-path characters. In that case, another shell is invoked, and whole command is passed through that. This includes e.g. cases when SHELL contents is quoted or back-ticked. White space is handled just fine, make will consider them argument separators. This works: SHELL:=/usr/bin/env python all:; @print 6,\ 5 This fails: SHELL:=/usr/bin/env ""python all:; @print 6,\ 5
Fixed in rawhide.