[debhelper-devel] [debhelper] 01/01: dh_compress: Resolve tmpdir to handle symlinks

Niels Thykier nthykier at moszumanska.debian.org
Mon Apr 11 18:13:15 UTC 2016


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 1418796f85ce27401673442e19977957d94079fe
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Apr 11 18:12:35 2016 +0000

    dh_compress: Resolve tmpdir to handle symlinks
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog | 4 ++++
 dh_compress      | 8 +++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3c5d7dc..ba689d1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,10 @@ debhelper (9.20160403+unreleased) UNRELEASED; urgency=medium
   * dh: Fix bug where "--help" or "--list" would not work
     unless "debian/compat" existed and had a supported
     compat level.  (Closes: #820508)
+  * dh_compress: Gracefully handle debian (or any other
+    path segment in the package "tmpdir") being a symlink
+    pointing outside the same directory.  Thanks to
+    Bernhard Miklautz for the report.  (Closes: #820711)
 
  -- Niels Thykier <niels at thykier.net>  Sat, 09 Apr 2016 09:20:32 +0000
 
diff --git a/dh_compress b/dh_compress
index fe3d6cb..55f7386 100755
--- a/dh_compress
+++ b/dh_compress
@@ -179,7 +179,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	if ($norm_from_dir !~ m{^/}) {
 		$norm_from_dir = "${olddir}/${tmp}";
 	}
-	my @normalized = normalize_paths($norm_from_dir, $tmp, @f);
+	my $resolved = abs_path($norm_from_dir)
+		or error("Cannot resolve $norm_from_dir: $!");
+	my @normalized = normalize_paths($norm_from_dir, $resolved, $tmp, @f);
 	my %uniq_f; @uniq_f{@normalized} = ();
 	@f = sort keys %uniq_f;
 
@@ -225,7 +227,7 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 }
 
 sub normalize_paths {
-	my ($cwd, $tmp, @paths) = @_;
+	my ($cwd, $cwd_resolved, $tmp, @paths) = @_;
 	my @normalized;
 	my $prefix = qr{\Q${tmp}/};
 
@@ -242,7 +244,7 @@ sub normalize_paths {
 			warning(qq{Interpreted "$path" as "$alt"});
 		}
 		error("${abs} does not exist") if not -e $abs;
-		push(@normalized, abs2rel($abs, $cwd));
+		push(@normalized, abs2rel($abs, $cwd_resolved));
 	}
 	return @normalized;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list