[gmx-developers] bad sed expression in share/template/Makefile.am

Ake Sandgren ake.sandgren at hpc2n.umu.se
Fri Nov 13 08:15:39 CET 2009


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 :-)

-- 
Ake Sandgren, HPC2N, Umea University, S-90187 Umea, Sweden
Internet: ake at hpc2n.umu.se   Phone: +46 90 7866134 Fax: +46 90 7866126
Mobile: +46 70 7716134 WWW: http://www.hpc2n.umu.se




More information about the gromacs.org_gmx-developers mailing list