Re: How to choose the shell?

John Freeman <[email protected]> Sat, 4 Sep 2021 17:32:05 -0500
Newsgroups gmane.comp.gnu.make.windows
Message-ID <CANm+4TVaPJi+n8bjmiS4y9US2gZ2cKs97iRpPT1MMsxc2URBbA@mail.gmail.com>
--000000000000fa25d905cb32fc0f
Content-Type: text/plain; charset="UTF-8"

On Sat, Sep 4, 2021 at 12:13 PM Eli Zaretskii <[email protected]> wrote:

> It's not documented because the details are complex and hard to
> explain, and the result isn't supposed to depend on whether Make
> invokes commands directly or via the shell.  So why do you care to
> know which way does make invoke a given command?
>

Not so complex and hard to explain that you couldn't concisely explain it
in this thread and [that thread](
https://lists.gnu.org/archive/html/make-w32/2020-05/msg00001.html). Just
use one of the two explanations you gave. They're totally sufficient, in my
opinion. The manual for Make is tens of thousands of words long and
explains a few much more complicated ideas. This addition wouldn't look out
of place in the least.

> GNU Make doesn't invoke the shell unless it (a) sees a shell
    built-in command, or (b) sees some character special to the
    shell.  Since the built-in commands of PowerShell are not known to
    GNU Make, you are left with the second option, and the no-op
    redirection achieves that.

> To trigger the use of a shell, you need to use some feature on the
command line that needs a shell.  For example, redirection or some
fancy quoting.


> What for?  Make is for building programs by running shell commands.
> As long as the results of running a command are the same, why should
> you care how that command is invoked, and why would you need a way to
> force invocation via the shell?
>

You assume that the results are the same. This thread and that thread have
demonstrated that they are not. I'm less offended that the shell isn't
invoked than I am that it is not documented _why_ it isn't invoked. I had a
Makefile that I thought should work according to the documented behavior,
and it didn't. _That_ is why I care how the commands are invoked. My
commands work in the shell, and don't work without the shell. So please let
me use the shell without having to sign up for the mailing list and jump
through an extra hoop on every command. A naive implementation would do the
right thing every time. This optimization is doing the wrong thing some of
the time.

--000000000000fa25d905cb32fc0f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Sat, Sep 4, 2021 at 12:13 PM Eli Zaret=
skii &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<br></d=
iv><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:=
1ex">
It&#39;s not documented because the details are complex and hard to<br>
explain, and the result isn&#39;t supposed to depend on whether Make<br>
invokes commands directly or via the shell.=C2=A0 So why do you care to<br>
know which way does make invoke a given command?<br></blockquote><div><br><=
/div><div>Not so complex and hard to explain that you couldn&#39;t concisel=
y explain it in this thread and [that thread](<a href=3D"https://lists.gnu.=
org/archive/html/make-w32/2020-05/msg00001.html">https://lists.gnu.org/arch=
ive/html/make-w32/2020-05/msg00001.html</a>). Just use one of the two expla=
nations you gave. They&#39;re totally sufficient, in my opinion. The manual=
 for Make is tens of thousands of words long and explains a few much more c=
omplicated ideas. This addition wouldn&#39;t look out of place in the least=
.<br></div><div><br></div><div>&gt; GNU Make doesn&#39;t invoke the shell u=
nless it (a) sees a shell<br>=C2=A0 =C2=A0 built-in command, or (b) sees so=
me character special to the<br>=C2=A0 =C2=A0 shell.=C2=A0 Since the built-i=
n commands of PowerShell are not known to<br>=C2=A0 =C2=A0 GNU Make, you ar=
e left with the second option, and the no-op<br>=C2=A0 =C2=A0 redirection a=
chieves that.</div><div><br></div><div>&gt; To trigger the use of a shell, =
you need to use some feature on the<br>
command line that needs a shell.=C2=A0 For example, redirection or some<br>
fancy quoting.<span class=3D"gmail-im"><br></span></div><div>=C2=A0</div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex">

What for?=C2=A0 Make is for building programs by running shell commands.<br=
>
As long as the results of running a command are the same, why should<br>
you care how that command is invoked, and why would you need a way to<br>
force invocation via the shell?<br></blockquote><div><br></div><div>You ass=
ume that the results are the same. This thread and that thread have demonst=
rated that they are not. I&#39;m less offended that the shell isn&#39;t inv=
oked than I am that it is not documented _why_ it isn&#39;t invoked. I had =
a Makefile that I thought should work according to the documented behavior,=
 and it didn&#39;t. _That_ is why I care how the commands are invoked. My c=
ommands work in the shell, and don&#39;t work without the shell. So please =
let me use the shell without having to sign up for the mailing list and jum=
p through an extra hoop on every command. A naive implementation would do t=
he right thing every time. This optimization is doing the wrong thing some =
of the time.<br></div></div></div>

--000000000000fa25d905cb32fc0f--