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

[SCM] Debian package checker branch, master, updated. 2.5.14-11-g171a400



The following commit has been merged in the master branch:
commit e0e206c3ca643b5d5dccc860ec2da67215345ff5
Author: Niels Thykier <niels@thykier.net>
Date:   Sun Jun 30 09:55:41 2013 +0200

    L::C::Source: Sanity check package names read from d/control
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index e32f1ab..480f06c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,11 @@ lintian (2.5.15) UNRELEASED; urgency=low
   * debian/rules:
     + [NT] Generate API documentation during build.
 
+  * lib/Lintian/Collect/Source.pm:
+    + [NT] "binaries" and "binary_field" now only exposes data
+      about entries in d/control with a valid package name.
+    + [NT] Document that "binaries" return an unorderd list.
+
  -- Niels Thykier <niels@thykier.net>  Sat, 29 Jun 2013 21:11:09 +0200
 
 lintian (2.5.14) unstable; urgency=low
diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index 099dd8d..e44942f 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -30,7 +30,7 @@ use Scalar::Util qw(blessed);
 use Lintian::Relation;
 use Parse::DebianChangelog;
 
-use Lintian::Util qw(read_dpkg_control);
+use Lintian::Util qw(read_dpkg_control $PKGNAME_REGEX);
 
 =head1 NAME
 
@@ -178,7 +178,9 @@ sub native {
 =item binaries
 
 Returns a list of the binary and udeb packages listed in the
-F<debian/control>.
+F<debian/control>.  The list is unordered.
+
+I<Note>: Package names that are not valid are silently ignored.
 
 Needs-Info requirements for using I<binaries>: L<Same as binary_package_type|/binary_package_type (BINARY)>
 
@@ -381,14 +383,17 @@ sub _load_dctrl {
         # syntax-error-in-control-file in this case via
         # control-file).
         die $@ unless $@ =~ /syntax error/;
+        $self->{source_field} = {};
         $self->{binary_field} = {};
         return 0;
     }
     my $src = shift @control_data;
-    $self->{source_field} = $src;
+    # In theory you can craft a package such that d/control is empty.
+    $self->{source_field} = $src // {};
 
     foreach my $binary (@control_data) {
         my $pkg = $binary->{'package'};
+        next unless defined($pkg) and $pkg =~ m{\A $PKGNAME_REGEX \Z}xsmo;
         $packages{$pkg} = $binary;
     }
     $self->{binary_field} = \%packages;

-- 
Debian package checker


Reply to: