[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pending release of 1.5

From: Tim Van Holder
Subject: Re: Pending release of 1.5
Date: 13 Feb 2003 11:33:24 +0100

On Wed, 2003-02-12 at 18:07, Boehne, Robert wrote:
> On Wed, 2003-02-12 at 10:14, Robert Boehne wrote:
> > > is not right.  The "\" before the "." is there to prevent
> > > "." from being a regular expression matching any character.
> > > So this should have been:
> > >  $SED -e "s/${shared_ext}\..*/${shared_ext}/"
> > 
> > Unfortunately, since $shared_ext will be '.so' and not '\.so', the
> > sed above mishandles names like (turning it into ''
> > instead of '')...
> > For maximum robustness, $shared_ext needs to be transformed to a valid
> > regex before this sed can run.
> So are you saying that the instances of ${shared_ext} should be escaped
> as \${shared_ext} ?  If we append a "\" to the front it will work
> when but not when shared_ext="" so I'm not sure how
> to go about fixing this.

No, I was suggesting that $shared_ext's contents would need to be
escaped (and \${shared_ext} wouldn't work btw, as the \ would escape
the $, preventing the contents of $shared_ext from being substituted).

I suppose doing something like
  shared_ext_sed=$(echo ${shared_ext} |sed -e 's/\([.\\^$]\)/\\\1/g')
would be too naive?  (Note: this seems to work only with $() and not
with backticks - then I get literal '\1's in shared_ext_sed...  Is
extra escaping needed within '' when inside ``?)
I'm also not sure if ^ and $ need escaping, as I think they only take
on meaning if at the very start or end of a regex, and neither position
is possible here.

So if shared_ext is '.my.lib$' (with literal '$'), we'd probably want it
transformed to '\.my\.lib\$' before feeding it to sed.
Granted, in 99% of cases only a leading '.' will need the added '\', and
a very limited number of projects will have library names that happen
to have the shared extension as final part of the library name, so
just doing what's in the original patch isn't _that_ bad.  But then
the docs should probably mention this as a pretty big caveat.

Tim Van Holder <address@hidden>

reply via email to

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