[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.
From: |
Noah Misch |
Subject: |
Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265] |
Date: |
Wed, 20 Oct 2004 15:33:16 -0700 |
User-agent: |
Mutt/1.5.6i |
On Wed, Oct 20, 2004 at 09:45:46PM +0100, Gary V. Vaughan wrote:
> (func_quote_for_eval): Four space indent margin for functions!
Does this deserve mention in HACKING?
> +# Save mangling of backslash escaped dollars by the above. Running this
> +# substitution after double_quote_subst notices and corrects expansion
> +# of already escaped meta-chars. \$x -> double_quote_subst -> \\$x,
> +# which doesn't protect $x from expansion. To correct this we do:
> +# \\$x -> sed_double_backslash -> \\\$x, properly protecting $x.
> +sed_double_backslash='s/\([[^\\]]\)\\\\$/\1\\\\\\$/g'
I am glad you caught that. The first $ does need a \, and I believe the \ in
the character class does not need one. That said, this substitution handles
'x\$y', but it does not seem to handle '\$y' (no non-backslash preceding
character) or 'x\\\$y'. I believe this variant does so:
# Re-`\' parameter expansions in output of double_quote_subst that were
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
# in input to double_quote_subst, that '$' was protected from expansion.
# Since each input `\' is now two `\'s, look for any number of runs of
# four `\'s followed by two `\'s and then a '$'. `\' that '$'. Note
# that the embedded single quotes serve only to enhance readability.
sed_double_backslash='s/\(\(^\|[^\]\)\(\\\\''\\\\''\)*\)''\\\\''\$/\1\\\\''\\''\$/g'
# Local Variables:
# mode: sh
# fill-column: 72
# End:
- FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265], Gary V. Vaughan, 2004/10/20
- Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265],
Noah Misch <=
- Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265], Gary V. Vaughan, 2004/10/21
- Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265], Noah Misch, 2004/10/22
- Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265], Gary V. Vaughan, 2004/10/22
- Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265], Noah Misch, 2004/10/22
- Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265], Gary V. Vaughan, 2004/10/22
- Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265], Noah Misch, 2004/10/22
- Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265], Gary V. Vaughan, 2004/10/22