make-w32
[Top][All Lists]
Advanced

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

RE: With SHELL=cmd, make fails to execute bat file paths starting with .


From: Duane Campbell
Subject: RE: With SHELL=cmd, make fails to execute bat file paths starting with ../
Date: Fri, 3 May 2013 16:21:23 -0700

> CreateProcess correctly on bat files, why don't you just give up the
> short-circuiting for all .bat files, and go through the cmd.exe invocation
> path (i.e., create a temporary bat file with the command invocation)
> whenever argv[0] ends with .bat?

I think gnu-make users need to be responsible for quoting (and proper slashes) 
for the cmd.exe shell.
This is true for unix shells as well as cmd.exe.

Also, without unneeded performance overhead, "make" cannot know what quoting is 
needed as cmd.exe (and programs it runs) are not definitive enough in behavior 
of parsing.

Here are some problems with proposal for special handling of argv[0] ending 
.bat (or .cmd which is an alternate extension for batchfiles).
- What should make do if argv[0] is "foo" ("foo" could be a .bat file, a .exe 
(or any other registered type))
- When argv[0] is "foo.bat" it might actually be an executable that runs 
(foo.bat.exe).



.dfc.


-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Eli Zaretskii
Sent: 2013-05-03 Friday 12:11
To: Erik Carstensen
Cc: address@hidden
Subject: Re: With SHELL=cmd, make fails to execute bat file paths starting with 
../

> Date: Fri, 3 May 2013 19:17:37 +0200
> From: Erik Carstensen <address@hidden>
> 
> This makefile reproduces the problem:
> 
> SHELL=cmd.exe
> default:
>     ./x.bat ""
>     ./x.bat
> 
> The first line succeeds on make 3.82, while the second line fails. With
> master, both lines fail (because the first one is short-circuited as well)

The failure should be expected, because cmd.exe does not generally
support forward slashes.  Use .\x.bat instead.

> It seems that the problem happens only when it is a path to a bat file, and
> the path starts with '../' or './'. Other relative paths, or paths with
> backslashes, all work.

As expected.

> I have one suggestion: Rather than pursuing the Sisyphean task to invoke
> CreateProcess correctly on bat files, why don't you just give up the
> short-circuiting for all .bat files, and go through the cmd.exe invocation
> path (i.e., create a temporary bat file with the command invocation)
> whenever argv[0] ends with .bat?

You are welcome to send patches.  But just based on the above example,
I don't yet see any compelling reason to change anything in the
current development sources, because what should work works, and what
shouldn't sometimes doesn't work and sometimes does (because cmd.exe
itself is inconsistent in its support of forward slashes, and that
even changes between Windows versions).

_______________________________________________
Make-w32 mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/make-w32



reply via email to

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