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: Noah Misch
Subject: Re: FYI: fix dollar handling in func_quote_for_expand [libtool--devo--1.0--patch-265]
Date: Fri, 22 Oct 2004 00:52:27 -0700
User-agent: Mutt/1.5.6i

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?

> 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?

Your commit was very different:

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

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'




reply via email to

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