I ran into a problem with an autoconf generated configure script today. The problem is that the path to srcdir includes an ampersand, (several, actually). This confuses the sed "s" commands which are written as "s&$foo&$bar&$baz" as once they are variable expanded, they look like "s&x&&y&z&&w&z&&x&".

I've worked around it by forcing srcdir to be something else for now, although this is inconvenient because srcdir is generated by an automatic system.

At the very least, the generated configure script should check for the embedded character and produce some useful error message if one is found.

I've looked for a more permanent solution, but the problem is that just about any character one might select for the "s" command could, conceivably, be part of a valid unix path name these days. The only solution I can think of offhand is to sed the pathname for the special character and escape it. something like this:

sed -e "s&"`echo $foo | sed -e "s&\&&\\\&&"`"&bar&baz

I think this will work, but it doesn't do anything for readability, and it'll need to be done for just about every sed "s" command in the generated configure script. That's a pretty sizable change that I wasn't sure you'd appreciate.

The problem is easy to reproduce. Create a srcdir named "&&&" and run configure from it.

--rich

Reply via email to