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

Eli Zaretskii <[email protected]> Sat, 04 May 2013 10:23:06 +0300
Newsgroups gmane.comp.gnu.make.windows
Message-ID <[email protected]>
> From: Duane Campbell <[email protected]>
> CC: "[email protected]" <[email protected]>, Duane Campbell
> 	<[email protected]>
> Date: Fri, 3 May 2013 16:21:23 -0700
> 
> I think gnu-make users need to be responsible for quoting (and proper slashes) for the cmd.exe shell.

I couldn't agree more.  Make cannot fix something the shell doesn't
accept on its command line.  Make can only be required not to ruin
something a shell will accept.

> 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).

If you are talking about the special handling of batch files with
whitespace in their names, then these two problems do not exist with
the current implementation.  That's because the decision whether the
special handling should be in effect is made _after_ Make already
searched and found argv[0], and determined its full absolute file
name, including the extension.  In addition to cleanly solving the
difficulties you mention, this solution has the benefit of doing TRT
with batch files which have whitespace characters in their leading
directories, not in their basenames.

(And yes, both .bat and .cmd batch files get this special handling.)