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

Eli Zaretskii <[email protected]> Fri, 11 Apr 2014 11:32:13 +0300
Newsgroups gmane.comp.gnu.make.devel
Message-ID <[email protected]>
> Date: Thu, 10 Apr 2014 22:55:34 +0200
> Cc: [email protected], [email protected]
> From: Frank Heckenbach <[email protected]>
> 
> If make would define this by default and apply it automatically when
> substituting a variable in a recipe, the recipe could simply look
> like this, without any explicit quoting:
> 
> %.x: %.y
> 	process $< -o $@
> 
> Which make internally would turn into:
> 
> 	process $(call SHELL_QUOTE,$<) -o $(call SHELL_QUOTE,$@)
> 
> So when calling make "a b'c<d.x", make would e.g. call:
> 
> 	process 'a b'\''c<d'.y -o 'a b'\''c<d'.x
> 
> > > will not continue to work if $</$@ contain special characters (which
> > > I think is not so bad because they already don't work if $</$@
> > > contain a certain special character, i.e. ').
> > 
> > So how would you suggest to handle the built-in rules such that they
> > will still work with file names that have embedded spaces?
> 
> If SHELL_QUOTE is applied automatically, the built-in rules need no
> modification because they don't contain explicit quoting either.
> 
> Now, if you want to use another interpreter with different quoting
> rules, you can do:
> 
> SHELL = /bin/frob
> SHELL_QUOTE = $(subst or whatever ...)

OK, but that will make using SHELL_QUOTE mandatory (i.e. not
optional), and we should require that users of non-default shells must
set SHELL_QUOTE accordingly.

I'm OK with that, I just thought you had some suggestion that didn't
require SHELL_QUOTE.  (I think that coming up with a correct
SHELL_QUOTE definition in Make syntax for a given shell is a
non-trivial job.)