[gmx-developers] bad sed expression in share/template/Makefile.am
Mark Abraham
Mark.Abraham at anu.edu.au
Fri Nov 13 23:52:19 CET 2009
Ake Sandgren wrote:
> On Fri, 2009-11-13 at 11:31 +1100, Mark Abraham wrote:
>> Ake Sandgren wrote:
>>> Hi!
>>>
>>> The sed in share/template/Makefile.am uses "," as separator. This is bad
>>> since LDFLAGS and others might contains things like -Wl,-rpath and other
>>> things with "," in them. "#" is usually a better choice.
>> Using "," as a sed separator seems to be standard practice with the
>> autotools. From autoconf docs:
>>
>> "When using sed, don't use -e except for indenting purpose. With the s
>> command, the preferred separator is `/' unless `/' itself is used in the
>> command, in which case you should use `,'. "
>>
>> Wouldn't "#" get interpreted as a Makefile comment?
>
> Nope, it's within single-quotes.
>
> And the comment above about "/" of course also applies to "," :-)
>
> The problem is that there is no safe separator in sed. You could en up
> in the situation, very low probability of course but still, that ALL
> characters is used in the expression.
> One could find one by using something like
> echo "abcdef...ABC...0123...+-_:;,*?!#%&(everything in the ASCII set)" |
> tr -d `echo "$(LDFLAGS)$(...)..."` | cut -c1
> but that is kind of overkill :-)
If there are no safe characters, then the best way forward is that the
chosen character be subject to some convention, so the user has a chance
of managing the situation (i.e. manual escaping) once they work out the
problem. Hence the above quote, I suppose.
Mark
More information about the gromacs.org_gmx-developers
mailing list