[Reproducible-commits] [dpkg] 41/63: Dpkg::Index: Check existence of search criteria

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Mar 4 17:44:44 UTC 2016


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

lunar pushed a commit to branch pu/buildinfo
in repository dpkg.

commit 40f5f8f76b023092f10eca8ab34b87fffbe3d207
Author: Guillem Jover <guillem at debian.org>
Date:   Sun Feb 21 11:36:20 2016 +0100

    Dpkg::Index: Check existence of search criteria
    
    When checking a regex or a string match we should avoid comparing
    against undefined fields, as those produce perl warnings, and will
    never match anyway.
    
    We leave the CODE references alone, as the caller might want to check
    if the field value is undefined.
    
    Closes: #780906
    Based-on-patch-by: Daniel Dehennin <daniel.dehennin at baby-gnu.org>
---
 debian/changelog      | 3 +++
 scripts/Dpkg/Index.pm | 6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ec2fc9e..e7ce043 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -50,6 +50,9 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
     - Only warn once when a diff patches a file multiple times in
       Dpkg::Source::Patch, and fix the warning message to make it clear that
       the diff might be patchig the file more than once, not just twice.
+    - Check existence of search criteria in Dpkg::Index when checking with a
+      regex or a string match. Closes: #780906
+      Base on a patch by Daniel Dehennin <daniel.dehennin at baby-gnu.org>.
   * Build system:
     - Fix building development documentation.
   * Test suite:
diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm
index 1bccfe1..dacaeba 100644
--- a/scripts/Dpkg/Index.pm
+++ b/scripts/Dpkg/Index.pm
@@ -227,7 +227,8 @@ sub get_keys {
     foreach my $s_crit (keys %crit) { # search criteria
 	if (ref($crit{$s_crit}) eq 'Regexp') {
 	    @selected = grep {
-		$self->{items}{$_}{$s_crit} =~ $crit{$s_crit}
+		exists $self->{items}{$_}{$s_crit} and
+		       $self->{items}{$_}{$s_crit} =~ $crit{$s_crit}
 	    } @selected;
 	} elsif (ref($crit{$s_crit}) eq 'CODE') {
 	    @selected = grep {
@@ -235,7 +236,8 @@ sub get_keys {
 	    } @selected;
 	} else {
 	    @selected = grep {
-		$self->{items}{$_}{$s_crit} eq $crit{$s_crit}
+		exists $self->{items}{$_}{$s_crit} and
+		       $self->{items}{$_}{$s_crit} eq $crit{$s_crit}
 	    } @selected;
 	}
     }

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



More information about the Reproducible-commits mailing list