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

[SCM] Debian package checker branch, master, updated. 2.5.3-53-g84405fa



The following commit has been merged in the master branch:
commit 84405fa5688ff30622bc4b1c8fec1bbb7b4fc1a8
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Oct 9 14:24:46 2011 +0200

    Fixed a test regression caused by the last commit
    
    coll/unpacked now properly copes with symlinks that point inside
    the package.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/collection/debfiles b/collection/debfiles
index c468435..6fc4bdf 100755
--- a/collection/debfiles
+++ b/collection/debfiles
@@ -37,8 +37,17 @@ if (-e 'debfiles') {
         or fail('cannot rm old debfiles directory');
 }
 
-fail ("debian dir for $pkg is a symlink")
-    if -l 'unpacked/debian';
+if ( -l 'unpacked/debian' ) {
+    require Cwd;
+    my $target = Cwd::abs_path ('unpacked/debian');
+    my $ud = Cwd::abs_path ('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/,;
+}
 
 # Copy the whole debian directory
 copy_dir('unpacked/debian/', 'debfiles')

-- 
Debian package checker


Reply to: