make-w32
[Top][All Lists]
Advanced

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

Re: Incorrect quoting of """" """" in master branch, with SHELL=cmd.exe


From: Eli Zaretskii
Subject: Re: Incorrect quoting of """" """" in master branch, with SHELL=cmd.exe
Date: Fri, 03 May 2013 22:20:22 +0300

> Date: Fri, 3 May 2013 17:17:20 +0200
> From: Erik Carstensen <address@hidden>
> 
> When passing """" """" to a shell, it is evaluated to a single word " " if
> cmd.exe evaluates it, but  to an unquoted single space if make
> short-circuits the cmd.exe argument.

You should use a backslash to produce a literal quote that should be
passed to a program.  That's what the Microsoft startup code provides
as the way to get quote characters into programs.

Unfortunately, cmd.exe does not support such escaping, so Make needs
to choose which method to support, and it naturally leans towards
programs rather than towards cmd.exe itself, because the commands that
need the shell or explicit batch files are the minority.

If you do know that cmd.exe will be invoked, you can either double the
quotes, as the cmd.exe documentation describes, or us the ^ character
to escape the quotes.

> My actual use case is similar to the 'mkdir' invocation in foo.mk (a file
> with spaces needs to be quoted twice in order to be passed to commands in a
> recursive make).

Please show that use case, or something similar.  I don't immediately
understand why recursive invocation means you'd need to quote a file
name twice.  E.g., why not use this instead:

SHELL=cmd.exe
default:
        $(MAKE) -f foo.mk x="a b"




reply via email to

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