[Top][All Lists]

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

Re: Pending release of 1.5

From: Schleicher Ralph (LLI)
Subject: Re: Pending release of 1.5
Date: Thu, 13 Feb 2003 15:06:17 +0100

Tim Van Holder wrote:

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

See my other message <address@hidden> for how I did
I used the following small script for testing the quoting:

#! /bin/sh -x


cmds='tempext=`echo $shared_ext | $SED -e
'\''s,\([^()0-9A-Za-z{}]\),\\\\\1,g'\''`; templib=`echo $lib | $SED -e
"s/\${tempext}\..*/\${tempext}/"`; echo $templib'
eval "$cmds"

The command "sed -e 's,\([^()0-9A-Za-z{}]\),\\\1,g'" performs rock
solid regexp quoting for basic regular expressions.  In libtool.m4
you must double the "[" and "]" due to M4 quoting.  I'm also quite
confident that "\\\\\1" (5 times "\") in the replacement text is
correct but it also works with 6 "\".


reply via email to

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