[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Backslash quoting (was: Re: Possible solution for special characters
From: |
Frank Heckenbach |
Subject: |
Re: Backslash quoting (was: Re: Possible solution for special characters in makefile paths) |
Date: |
Wed, 30 Apr 2014 04:22:45 +0200 |
Paul Smith wrote:
> > Each special character that we'd like to quote would be prefixed with
> > a backslash in the makefile. Backslashes would quote themselves.
>
> [...]
>
> POSIX-y shell invocation: the string is left as-is, and passed to
> system() or the equivalent. Because we know that make's backslash
> quoting rules are a strict subset of the POSIX shell rules, it's OK to
> pass along the string without doing anything about the backslashes. If
> we figure out how to do automated quoting (SHELL_QUOTE) we'd do it
> here... or not.
Just to clarify: SHELL_QUOTE was part of the encoded-string
proposal. In this proposal where make keeps backslashes, no such
shell-quoting is needed.
As I said before, I'm a bit skeptical about the subset, though: If a
string contains unquoted characters which are special to the shell,
but not to make (e.g. x`foo`y), make would treat them as normal
characters of a file name (e.g. in targets), but when passed on to
the shell (via $@ or some other variable), the shell would interpret
them quite differently. So to avoid unpleasant surprises, I think
make should error when they're used in such contexts. AFAICS, this
wouldn't break this proposal otherwise, just require the set of
characters special(1) to make to be a *superset* of those special in
(common) shells.
(1) in the sense that they need to be \-quoted when used in those
contexts, and therefore make would need to auto-quote them when
they appear in command-line goals etc.