bug-make
[Top][All Lists]

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

 From: Eli Zaretskii Subject: Re: [bug #41246] Allow to switch shell batch mode at runtime instead of build time Date: Tue, 04 Feb 2014 20:01:18 +0200

> From: Paul Smith <address@hidden>
> Date: Tue, 04 Feb 2014 12:28:53 -0500
>
> But I do see a problem above; what if the literal file 'foo\bar' (a file
> with a backslash in the name) existed?

Such a file cannot exist on Windows: the backslash character is not
allowed in a file name, unlike on Unix.

> Then this would work on UNIX but fail on Windows, because (Mike
> shows) too many backslashes are eaten.
>
> On UNIX, "grep foo < foo\\bar" would do as Mike shows the batch mode
> shell to do, and look for the literal file 'foo\bar', but note his
> example above where BOTH backslashes are dropped in non-batch mode.
>
> That seems wrong to me...

There's no alternative: Make on Windows must support both forward- and
back-slashes, or else our Windows users will lynch us.  That support
doesn't come without a price, but I see no way around that, at least
not a way that avoids the issue entirely.  A backslash is a legitimate
directory separator on Windows, and must be handled as such.  But it
is also an escape ("quote") character -- in Unix shells and in
Makefiles (e.g., to escape-protect the colon and other special
characters).  I see no way of supporting the same character in several
different and even contradictory roles, without some heuristics which
necessarily sacrifices rare and/or unsupported scenarios and use
cases, and favors frequent and supported ones.

IOW, I don't think the analogy with Unix is valid here, because it
sets the bar way too high, so high, in fact, that it cannot be
cleared.