[Reproducible-commits] [dpkg] 07/17: Dpkg::Deps: Do not generate perl warnings on undef versions in deps_compare()

Holger Levsen holger at layer-acht.org
Tue May 3 08:43:42 UTC 2016


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

holger pushed a commit to annotated tag 1.16.13
in repository dpkg.

commit 15663145f2bee7033a9c9f9733895b610ac428e9
Author: Guillem Jover <guillem at debian.org>
Date:   Wed Apr 2 03:59:47 2014 +0200

    Dpkg::Deps: Do not generate perl warnings on undef versions in deps_compare()
    
    Cherry picked from commit 1469ab6fc964ffd7f83e4e842ad4cf89a48328e5.
    
    Ref: #737731
---
 debian/changelog          | 2 ++
 scripts/Dpkg/Deps.pm      | 5 ++++-
 scripts/t/400_Dpkg_Deps.t | 6 +++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 53a6c8c..f86d091 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ dpkg (1.16.13) UNRELEASED; urgency=low
   [ Guillem Jover ]
   * Do not NULL-terminate the list in the compat scandir(), as this might
     cause a segfault in case the function returns 0 entries.
+  * Do not generate perl warnings on undef versions in
+    Dpkg::Deps::deps_compare(). See: #737731
 
   [ Updated scripts translations ]
   * Fix a typo in the German scripts translation.
diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index 21b8e9c..5206ea8 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -1,4 +1,5 @@
 # Copyright © 2007-2009 Raphaël Hertzog <hertzog at debian.org>
+# Copyright © 2008-2009,2012-2014 Guillem Jover <guillem at debian.org>
 #
 # This program is free software; you may redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -371,9 +372,11 @@ sub deps_compare {
     }
     my $ar = defined($a->{relation}) ? $a->{relation} : "undef";
     my $br = defined($b->{relation}) ? $b->{relation} : "undef";
+    my $av = $a->{version} // '';
+    my $bv = $a->{version} // '';
     return (($a->{package} cmp $b->{package}) ||
 	    ($relation_ordering{$ar} <=> $relation_ordering{$br}) ||
-	    ($a->{version} cmp $b->{version}));
+	    ($av cmp $bv));
 }
 
 
diff --git a/scripts/t/400_Dpkg_Deps.t b/scripts/t/400_Dpkg_Deps.t
index 932d113..0d867a9 100644
--- a/scripts/t/400_Dpkg_Deps.t
+++ b/scripts/t/400_Dpkg_Deps.t
@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-use Test::More tests => 20;
+use Test::More tests => 21;
 
 use strict;
 use warnings;
@@ -31,6 +31,10 @@ my $dep_multiline = deps_parse($field_multiline);
 $dep_multiline->sort();
 is($dep_multiline->output(), $field_multiline_sorted, "Parse, sort and output");
 
+my $dep_sorted = deps_parse('pkgz, pkgz | pkga, pkga (>= 1.0), pkgz (<= 2.0)');
+$dep_sorted->sort();
+is($dep_sorted->output(), 'pkga (>= 1.0), pkgz, pkgz | pkga, pkgz (<= 2.0)', 'Check sort() algorithm');
+
 my $dep_subset = deps_parse("libatk1.0-0 (>> 1.10), libc6, libcairo2");
 is($dep_multiline->implies($dep_subset), 1, "Dep implies subset of itself");
 is($dep_subset->implies($dep_multiline), undef, "Subset doesn't imply superset");

-- 
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