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: Sun, 23 Feb 2014 13:44:13 -0500 > > FOO = foo\ bar > > $(FOO): ; @echo '"$@"' '"$(FOO)"' '"$(addsuffix .txt,$(FOO))"' > > In your suggested implementation what is printed? As far as I can see > it will be one of these three (assuming that $@ is "foo bar" as we've > discussed here): > > "foo bar" "foo bar" "foo bar.txt" > or > "foo bar" "foo\ bar" "foo\ bar.txt" > or > "foo bar" "foo\ bar" "foo\.txt bar.txt" > > ? The first, I hope. But again, let's first find the best way of expressing such strings in a Makefile, and get to their expansion after that. These are two separate issues. > > > > > Now we come along with the next release of GNU make. If you want > > > > "foo\" and "bar" you have to modify your > > > > > makefile: > > > > > FOO = foo\\ bar > > > > > Right? > > > > > > > It's one possibility, yes. > > > > > > I'd like to hear another one. > > > > Another one is FOO = "foo bar". > > Well, in any event you're still forced to modify the makefile; that's > what I was getting at. Then we are in violent agreement. But changes like that are inevitable whatever path we choose, I think. If the Makefiles to be changed are rare and far in between, I think we are good. > > That's not my interpretation of the current situation. My > > interpretation is that we do have problems, but we ignore them because > > colons in file names are rare. > > I think that's a very accurate assessment of the situation with colons. > However, I don't think saying that we've managed to live with the > problems with colons so it's OK to extend those same problems to > whitespace, is necessarily the right answer. My point was that we already use a backslash to quote some characters. > The fact is that colons ARE rare in filenames. Not on Windows ;-) > > > The difference between this and $[ is that (a) backslashes are much more > > > common than someone using "[" as a make variable, and (b) assigning to > > > [ can be detected by make and a warning or error generated, so users > > > know that there is a backward compat problem. Adding new backslash > > > quoting leads to silent changes in behavior. > > > > There's a program called [.exe on my disk, did you consider that? > > There's a program called "[" on my disk, too... :-). But I don't see > how that conflicts with the make variable $[... ? You only think about Make variables, but I also consider the complications with command lines. Shell-like quoting and escaping has the advantage that it will never conflict with command lines.