diff options
author | Niels Thykier <niels@thykier.net> | 2018-05-03 05:20:26 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2018-05-03 05:20:26 +0000 |
commit | ce3ce761086919fd6e20b840e6f02407bffaaca7 (patch) | |
tree | 14dfb1499fa1bcdacec999ef4cda7f85f076318d | |
parent | 9aae5bdccd626c2587cb700f23b1d91764bca8c7 (diff) | |
download | debhelper-ce3ce761086919fd6e20b840e6f02407bffaaca7.tar.gz |
rename_path: Fall back to mv when errno is EXDEV
Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | lib/Debian/Debhelper/Dh_Lib.pm | 14 |
2 files changed, 17 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog index e2c1a0dc..c9070a6e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,12 @@ debhelper (11.3) UNRELEASED; urgency=medium explicit shlibs files for a subset of them. Previously, the -V option could have been ignored for some of the packages containing libraries. + * Dh_Lib.pm: Fall back to a regular mv(1) when rename fails + with EXDEV (cross mount point moves). This restores + debhelper's ability to move files between mount points, + which can happen in dh_builddeb has to correct the + extension of a binary package built by dpkg-deb. + Thanks to Evan Krall for the report. (Closes: #897569) [ Dmitry Shachnev ] * qmake.pm: Use ${DEB_HOST_GNU_TYPE}-qmake wrapper for diff --git a/lib/Debian/Debhelper/Dh_Lib.pm b/lib/Debian/Debhelper/Dh_Lib.pm index e25b696c..9c829f0f 100644 --- a/lib/Debian/Debhelper/Dh_Lib.pm +++ b/lib/Debian/Debhelper/Dh_Lib.pm @@ -31,7 +31,7 @@ use constant { 'DBGSYM_PACKAGE_TYPE' => DEFAULT_PACKAGE_TYPE, }; -use Errno qw(ENOENT); +use Errno qw(ENOENT EXDEV); use Exporter qw(import); use File::Glob qw(bsd_glob GLOB_CSH GLOB_NOMAGIC GLOB_TILDE); our (@EXPORT, %dh); @@ -535,8 +535,16 @@ sub rename_path { } return 1 if $dh{NO_ACT}; if (not rename($source, $dest)) { - my $files = escape_shell($source, $dest); - error("mv $files: $!") + my $ok = 0; + if ($! == EXDEV) { + # Replay with a fork+exec to handle crossing two mount + # points (See #897569) + $ok = _doit('mv', $source, $dest); + } + if (not $ok) { + my $files = escape_shell($source, $dest); + error("mv $files: $!"); + } } return 1; } |