Bug#955568: dh_install (and friends?) doesn't(/don't) remove source dirs ending in slash

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Bug#955568: dh_install (and friends?) doesn't(/don't) remove source dirs ending in slash

Mihai Moldovan
Package: debhelper
Version: 12.10

dh_install* takes a --sourcedir parameter which can be leveraged to pick data
from a specific destroot, which is very handy when building a package multiple
times with different features and creating conflicting binary packages.


Short example (pseudo-Makefile-code):

dh_auto_install --destdir=debian/destroot/variant1/
dh_auto_install --destdir=debian/destroot/variant2/

dh_install -ppkgvar1 --sourcedir=debian/destroot/variant1/
dh_install -ppkgvar2 --sourcedir=debian/destroot/variant2/


This example will fail to work correctly at the moment. It will pick files from
debian/destroot/variant{1,2} alright, but stage them into debian/pkgvar{1,2}/
WITH the specified destroot, creating paths such as
/debian/destroot/variant1/usr/bin/binary.

The compute_dest sub is supposed to remove the source dir part (either default
or user-specified), but won't handle paths ending in a slash correctly, or for
that matter remove anything at all.

Hence, passing --sourcedir=debian/destroot/variant{1,2} will work as expected.

The sourcedir input should probably be sanitized/canonicalized (not talking
about full pathname-and-symlink-canonicalization, which is a whole different
beast) so that the prefix is actually removed from the destination directory,
whether it ends in a slash, a hundred slashes or no slash at all.


This is applicable to at least dh_install, other helplets might also need such
fixes, though I haven't gone through the full dh_install* range to determine
which are broken and which aren't. dh_installexamples, for instance, is fine as
far as I can tell.



Mihai


signature.asc (916 bytes) Download Attachment