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

[SCM] Debian package checker branch, master, updated. 2.5.12-5-g84541af



The following commit has been merged in the master branch:
commit 84541af759092c747606d0961e52327567648159
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Apr 20 10:24:37 2013 +0200

    coll/debfiles: Use is_ancestor_of from L::Util
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/collection/debfiles b/collection/debfiles
index 059f474..39b1c27 100755
--- a/collection/debfiles
+++ b/collection/debfiles
@@ -23,10 +23,10 @@ package Lintian::coll::debfiles;
 
 use strict;
 use warnings;
-
+use autodie;
 
 use lib "$ENV{'LINTIAN_ROOT'}/lib";
-use Lintian::Util qw(copy_dir delete_dir fail);
+use Lintian::Util qw(copy_dir delete_dir is_ancestor_of fail);
 
 sub collect {
 my ($pkg, $type, $dir) = @_;
@@ -38,21 +38,21 @@ if ( -e "$dir/debfiles") {
         or fail('cannot rm old debfiles directory');
 }
 
-if ( -l "$dir/unpacked/debian" ) {
-    require Cwd;
-    my $target = Cwd::abs_path ("$dir/unpacked/debian");
-    my $ud = "$dir/unpacked";
-    fail ("cannot resolve debian directory symlink in $pkg: $!") unless $target;
-    fail ("cannot resolve unpacked dir for $pkg: $!") unless $ud;
-    # We need the the trailing slash on $ud to ensure $target is a subdir of $ud.  However
-    # if $target eq $ud, we also need a trailing slash on $target for the comparision to
-    # be successful
-    fail ("debian directory in $pkg is an unsafe symlink!") unless "$target/" =~ m,^$ud/,;
+if ( ! -d "$dir/unpacked/debian/" ) {
+    mkdir("$dir/debfiles");
+    return;
+}
+if ( -l "$dir/unpacked/debian") {
+    if (!is_ancestor_of("$dir/unpacked", "$dir/unpacked/debian/")) {
+        # unsafe, stop
+        mkdir("$dir/debfiles");
+        return;
+    }
 }
-
 # Copy the whole debian directory
-copy_dir ("$dir/unpacked/debian/", "$dir/debfiles")
-    or fail("cannot copy unpacked/debian to debfiles: $!");
+copy_dir("$dir/unpacked/debian/", "$dir/debfiles")
+    or fail('cannot copy unpacked/debian to debfiles');
+return;
 
 }
 
diff --git a/debian/changelog b/debian/changelog
index 4396f0a..969d9e5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,10 @@ lintian (2.5.13) UNRELEASED; urgency=low
       distribution.  Thanks to Romain Francoise for the
       report and the patch.  (Closes: #705170)
 
+  * collection/debfiles:
+    + [NT] Replace makeshift "is_ancestor_of" check with the
+      one from L::Util.
+
   * lib/Lintian/Util.pm:
     + [NT] Fix a race condition in touch_file.
     + [NT] Add sanity check in perm2oct for bad permission

-- 
Debian package checker


Reply to: