Re: Quoting special characters (was: Re: Possible solution for special characters in makefile paths)

Eli Zaretskii <[email protected]>
Newsgroups gmane.comp.gnu.make.devel
Message-ID <[email protected]>
> From: Paul Smith <[email protected]>
> Cc: [email protected]
> Date: Mon, 24 Feb 2014 17:30:16 -0500
> 
> > > It would be nice if that were true, but IMHO it's not really the case.
> > > In fact these issues are only partially separable, because some methods
> > > of expression in the makefile imply massive problems if we want to have
> > > a particular expansion.
> > 
> > They are not entirely separable, but they can surely be addressed
> > separately, one after the other.  That is what I meant.
> 
> That's what I'm doing: assuming we implement your suggestion of
> backslash-quoted whitespace, which I do agree could work _on the parsing
> side_, let's discuss the problems that will have to be solved on the
> expansion side as a result of this syntax.

Sorry, I didn't understand we were past that first issue.  Until very
recently there was a lot of talk about how the proposed new meaning of
a backslash might break too many Makefiles out there.

Sorry for being so slow.

> As discussed before, our desired result is that this makefile:
> 
>   FOO = foo\ bar
>   $(FOO): ; @echo '$(FOO)' > '$@'
> 
> would run this command:
> 
>   echo 'foo bar' > 'foo bar'
> 
> On the other hand POSIX, and 40 years of history and writing of
> makefiles, requires that this:
> 
>   FOO = foo\ bar
>   all: ; @echo '$(FOO)'
> 
> runs this command:
> 
>   echo 'foo\ bar'
> 
> How can we square this circle?

By accepting Frank's suggestion, I guess, under which the backslash is
kept and output in the expansion.

> > If you are saying that $[string with spaces] is another candidate that
> > we should consider, I agree.  If you are saying something else, I'm
> > afraid I didn't get it yet.
> 
> My original proposal was that we would quote content on the input side
> using a new quoting method.  One possible syntax I proposed was using
> $[...] where everything inside the brackets was quoted.  So:
> 
>   FOO = $[foo bar]
> 
> would be equivalent to this, using your backslash suggestion:
> 
>   FOO = foo\ bar
> 
> That's what (I thought) this sub-thread was talking about: I'm saying
> there's no compatibility problem between the proposal to use "$[...]"
> for quoting strings in a makefile, and the use of "[" (or "[.exe") in a
> make recipe.

OK, but the issue of how to expand $[foo bar] in various contexts
still needs to be discussed, because (unlike with the backslash) we
cannot leave it in the expansion.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.