bug-autoconf
[Top][All Lists]
Advanced

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

ampersand in path name


From: K Richard Pixley
Subject: ampersand in path name
Date: Tue, 31 Jul 2012 12:36:15 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/16.0 Thunderbird/16.0a2

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

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