libtool-patches
[Top][All Lists]
Advanced

[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: Gary V. Vaughan
Subject: Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265]
Date: Fri, 22 Oct 2004 09:01:16 +0100
User-agent: Mozilla Thunderbird 0.8 (Macintosh/20040913)

Noah Misch wrote:
On Thu, Oct 21, 2004 at 04:03:12PM +0100, Gary V. Vaughan wrote:


+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.

Although GNU sed may manage without (I haven't checked), BSD sed does need it
(otherwise \] becomes an atom, and the character class is then unterminated).


I could not reproduce that behavior in /usr/bin/sed of Mac OS X 10.1 or FreeBSD
5.2.1.  Do you recall which BSD's sed interpreted \] that way?

/usr/bin/sed on my Mac OS X 10.3.5 doesn't parse it correctly :-(

Unfortunately, alternation is not very portable (Apple's sed doesn't support
it at all), so we need two expressions.  The following works for me.  I'll
patch HEAD and branch-2-0 shortly if noone complains that it fails for them...

sed_double_backslash='
             s/^\(''\\\\''\\\\''\)*''\\\\''\$/\1''\\\\''\\$/;
   s/\([[^\\]]\(''\\\\''\\\\''\)*\)''\\\\''\$/\1''\\\\''\\$/g'


Those look excellent.  You do need a /g on the first substitution, do you not?

Nope, there can be only one ^ anchored match :-)

Your commit was very different:

sed_double_backslash='s/^\(\(''\\\\''\\\\''\)*''\\\\''\$\)/\\\1/;
                s/\([[^\\]]\(''\\\\''\\\\''\)*''\\\\''\$\)/\\\1/g'

Gah!  Committed and merged from the wrong tree :-o

I think that does not work.  If I hand-parse correctly,

        double_quote_subst           sed_double_backslash
'a\$x' --------------------> 'a\\$x' ---------------------> '\a\\$x'

This just came to mind; it shortens things similarly:

sed_double_backslash='
              s/^\(\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g;
        s/\([[^\\]]\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g'


Good call.  I'm committing a fix right now :-)

Cheers,
        Gary.
--
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]