[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Please normalize command line paths
From: |
BJörn Lindqvist |
Subject: |
Please normalize command line paths |
Date: |
Sun, 30 Sep 2007 01:52:13 +0000 |
In some autotooled project, when I type:
./configure --prefix=/usr/
I want autoconf to treat it as if I typed:
./configure --prefix=/usr
That is, it should normalize the path string. /usr/ is always
equivalent to /usr as the canonical definition of a directory name
doesn't end with a /. The reason why I often type '/usr/' when I
really mean '/usr' is because bash autocompletes, so that if you type
'/u<tab>' it expands to '/usr/'.
If you install an autotooled project with a prefix like '/usr/'
(instead of '/usr') it can lead to two sorts of annoyances: 1)
ugliness 2) path comparison failures. The ugliness is the double slash
that autoconf inserts in paths. It does something like this:
$libdir = $prefix + '/lib'
which results in $libdir = '/usr//lib'. In the Python package, this
results in tracebacks containing the double slash, like this:
>>> urllib.urlopen(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr//lib/python2.5/urllib.py", line 82, in urlopen
...
It also leads to pkg-config .pc files containing the double slash
which means that packages using that particular .pc file will also
suffer the double slash when getting the compiler flags using commands
like 'pkg-config --cflags somepackage'.
Path comparison failures may also happen when, for example, some
package expects expects its share directory to be
'/usr/share/somepackage', but which according to autoconf is
'/usr//share/somepackage'. This is not really autoconfs fault, but
many programs use faulty path comparison methods in which '/usr//lib'
is treated as different from '/usr/lib'.
The fix for this problem is, as expected, really trivial. A one-liner
sed or awk should do it, but there may be even more efficient methods.
A description of the problem and a proposed fix for the problem for
the Python package is posted here:
http://bugs.python.org/issue1676135. But as this problem affects many
more packages and as it be very much work to add this fix to each and
every autotooled package in existence, I propose this fix to be
implemented within autoconf.
--
mvh Björn
- Please normalize command line paths,
BJörn Lindqvist <=