make-w32
[Top][All Lists]
Advanced

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

Re: How to choose the shell?


From: Eli Zaretskii
Subject: Re: How to choose the shell?
Date: Sun, 05 Sep 2021 20:15:45 +0300

> From: Paul Smith <psmith@gnu.org>
> Cc: jfreeman08@gmail.com, make-w32@gnu.org
> Date: Sun, 05 Sep 2021 12:53:47 -0400
> 
> On Sun, 2021-09-05 at 19:50 +0300, Eli Zaretskii wrote:
> > > If you change the default shell, then make will never use any
> > > shortcuts since, obviously, it can't know what the syntax is of
> > > some other random shell.
> > 
> > I don't think Make on Windows does this bit.
> 
> Are you sure?

Quite sure.  You will see in main.c that we set default_shell to the
name of the shell we find, and then the test in job.c, which compares
shell with default_shell and does "goto slow" if they don't compare
equal, is effectively disabled.

> If not, that's definitely a bad bug in the Windows port of GNU make.

It's a bug, but there are good reasons for it: unlike on Unix, the
"slow" operation on Windows is problematic, because Windows shells
don't support the "$SHELL -c COMMAND" way of invocation, and the
quoting of COMMAND also has its quirks.  So we only do "$SHELL -c" if
the shell is sh.exe or similar; otherwise we create a temporary batch
file and submit it to the shell.  But the way we build the batch file
assumes cmd.exe, because we have no idea how to write scripts for
other programs that can be used as "shells".  Also, we have no idea
about the quoting used by other shells, so the tests that decide to
"goto slow" due to fancy quoting are also prone to fail.

So patches to fix this are welcome, of course, but it isn't like the
problem has an easy solution in general, at least AFAIK.



reply via email to

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