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

[SCM] Debian package checker branch, master, updated. 2.5.11-222-g70ed124



The following commit has been merged in the master branch:
commit 70ed124b8ef22f131085bc49ef1febfc2a51ce33
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Apr 4 00:17:57 2013 +0200

    L::Collect::Package: warn when given suboptimal argument
    
    Emit a warning when unpacked or debfiles is given a path with a
    leading slash or dot-slash.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index 8e83272..e91684a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -219,6 +219,8 @@ lintian (2.5.12) UNRELEASED; urgency=low
   * lib/Lintian/Collect/Package.pm:
     + [NT] Ensure the "root" entry of indices do not contain itself.
       (Closes: #695866)
+    + [NT] Add warning to unpacked and debfiles when they are given a
+      path with leading slash or dot-slash.
   * lib/Lintian/Command/Simple.pm:
     + [NT] Use constant time lookup access instead of linear scan with
       "hashref" wait.
diff --git a/lib/Lintian/Collect.pm b/lib/Lintian/Collect.pm
index 76aed5b..4ddec82 100644
--- a/lib/Lintian/Collect.pm
+++ b/lib/Lintian/Collect.pm
@@ -19,6 +19,7 @@
 package Lintian::Collect;
 use strict;
 use warnings;
+use warnings::register;
 
 use Lintian::Util qw(get_dsc_info get_deb_info);
 use Carp qw(croak);
diff --git a/lib/Lintian/Collect/Package.pm b/lib/Lintian/Collect/Package.pm
index 84adaa9..bcaa756 100644
--- a/lib/Lintian/Collect/Package.pm
+++ b/lib/Lintian/Collect/Package.pm
@@ -219,10 +219,13 @@ sub _fetch_extracted_dir {
         croak "$field ($dirname) is not available" unless -d "$dir/";
         $self->{$field} = $dir;
     }
-    if ($file) {
+    if (defined $file and $file ne '') {
         # strip leading ./ - if that leaves something, return the path there
-        $file =~ s,^\.?/*+,,go;
-        return "$dir/$file" if $file;
+        if ($file =~ s,^(?:\.?/)++,,go) {
+            warnings::warnif('Lintian::Collect',
+                qq{Argument to $field had leading "/" or "./"});
+        }
+        return "$dir/$file" if $file ne '';
     }
     return $dir;
 }

-- 
Debian package checker


Reply to: