bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multi-line commands with quoted SHELL


From: Paul Smith
Subject: Re: multi-line commands with quoted SHELL
Date: Sun, 25 Feb 2007 21:09:01 -0500

On Thu, 2007-02-22 at 19:00 +0100, Petr Machata wrote:

> There is a bug tracked in Red Hat bugzilla
>       http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=219409
> 
> The problem is best demonstrated by this Makefile snippet:
> 
> all:;@echo e\
>       cho
> 
> With this make invocation, it works as intended:
> 
> $ make 'SHELL=/bin/sh'
> echo
> 
> But when the SHELL variable contains quotes, it fails:
> 
> $ make 'SHELL="/bin/sh"'
> e
> /bin/sh: line 1: cho: command not found
> make: *** [all] Error 127
> 
> The problem is that when SHELL contains quotations etc., /bin/sh is 
> invoked, and whole command is passed through that.  But the outer shell 
> then destroys the backslash-newline sequences.  The solution is to 
> singly-quote these.  The attached patch against make 3.81 does this.

Hm.  Personally I think this is an error and should not be handled, even
as it is currently handled.

If the user sets:

        SHELL = "/bin/sh"

in my opinion make should try to invoke the program
'"/bin/sh"' (including the quotes).  Having a quoted value of SHELL
invoked using /bin/sh -c (with another level of "indirectness") is, in
my opinion, wrong.

I can only assume this behavior of trying to manage quotes in the value
of SHELL is due to some bizarre behavior of some long-forgotten make
that GNU make tried to duplicate.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]