bug-make
[Top][All Lists]
Advanced

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

Re: [bug #41246] Allow to switch shell batch mode at runtime instead of


From: Mike Hommey
Subject: Re: [bug #41246] Allow to switch shell batch mode at runtime instead of build time
Date: Thu, 6 Feb 2014 16:01:06 +0900
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Feb 06, 2014 at 07:44:11AM +0200, Eli Zaretskii wrote:
> > Date: Thu, 6 Feb 2014 06:23:46 +0900
> > From: Mike Hommey <address@hidden>
> > Cc: address@hidden, address@hidden, address@hidden
> > 
> > On Wed, Feb 05, 2014 at 11:10:11PM +0200, Eli Zaretskii wrote:
> > > > Date: Thu, 6 Feb 2014 05:58:08 +0900
> > > > From: Mike Hommey <address@hidden>
> > > > Cc: address@hidden, address@hidden, address@hidden
> > > > 
> > > > But the thing is there is still inconsistency in how things end up being
> > > > invoked whether
> > > > - make calls them directly
> > > > - make uses sh -c
> > > > - make uses sh script.sh
> > > 
> > > When the shell is a Unixy one, only the first 2 methods are used, and
> > > they are used exactly like on Posix platforms.
> > 
> > Except when make is built with BATCH_MODE_SHELL_ONLY.
> 
> Indeed, that's what that compile time option is for.  But if that
> option messes up Make (does it?), we probably should delete it.
> 
> > Which is needed when sh -c fucks up with double quotes.
> 
> I asked for test cases where this happens.  Does this happen only when
> backslashes are used in file names?  If so, I don't think that
> matters, since backslashes aren't supposed to be used in file names
> when a Unixy shell is used.

I gave multiple examples already. It doesn't require backslashes to be a
problem. Here's another one:

$ cat <<EOF >foo.mk
default:
        c:/path/to/python.exe -c 'import sys; sys.argv[1:]' "a" b c
EOF
$ make -f foo.mk
c:/path/to/python.exe -c 'import sys; sys.argv[1:]' "a" b c
['a b', 'c']

And that (obviously) doesn't need make to fail:
(in a cmd.exe shell):
> c:/path/to/sh.exe -c "c:/path/to/python.exe -c 'import sys; sys.argv[1:]' 
> \"a\" b c"
['a b', 'c']

(yes, this is how make quotes it, and the quoting is correct)


On Thu, Feb 06, 2014 at 07:45:53AM +0200, Eli Zaretskii wrote:
> > Date: Thu, 6 Feb 2014 06:31:15 +0900
> > From: Mike Hommey <address@hidden>
> > Cc: address@hidden, address@hidden, address@hidden
> > 
> > > Except when make is built with BATCH_MODE_SHELL_ONLY. Which is needed
> > > when sh -c fucks up with double quotes.
> > 
> > And, more importantly, it's the first two that don't work the same way:
> > 
> > $ mkdir foo
> > $ echo foo > foo/bar
> > $ cat <<EOF >foo.mk
> > default:
> >         grep foo foo\\bar
> >         grep "foo" foo\\bar
> > $ make -f foo.mk
> > grep foo foo\\bar
> > foo
> > grep "foo" foo\\bar
> > /usr/bin/sh: foobar: No such file or directory
> 
> If you use forward slashes, do you see any problems in this case?

Obviously, no. But again, this is not a path problem:

$ cat <<EOF >foo.mk
default:
        echo foo foo\\bar
        echo "foo" foo\\bar
EOF
$ make -f foo.mk
echo foo foo\\bar
foo foo\bar
echo "foo" foo\\bar
foo foobar

$ msysmake -f foo.mk
echo foo foo\\bar
foo foo\bar
echo "foo" foo\\bar
foo foo\bar

Mike



reply via email to

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