The following commit has been merged in the master branch:
commit b1e8b79380a79d268982cb510ffb05d1f4e6a01e
Author: Guillem Jover <[email protected]>
Date: Tue Apr 23 15:23:27 2013 +0200
Dpkg::Arch: Properly fix debarch_to_debtriplet() callers
The previous checks have always been shady (the subsequent fix too),
as they didn't guarantee what they were checking for, i.e. that the
array was not missing an element. Now that debarch_to_debtriplet()
returns better values, just check for the correct array size (to be
future-proof), instead of checking for the array not being empty, or
for undefined elements (something that should never happen anymore).
diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index 56d3206..75f90cc 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -1,4 +1,4 @@
-# Copyright © 2006-2012 Guillem Jover <[email protected]>
+# Copyright © 2006-2013 Guillem Jover <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -399,7 +399,7 @@ sub debarch_eq($$)
my @a = debarch_to_debtriplet($a);
my @b = debarch_to_debtriplet($b);
- return 0 if grep(!defined, (@a, @b)) or !scalar(@a) or !scalar(@b);
+ return 0 if scalar @a != 3 or scalar @b != 3;
return ($a[0] eq $b[0] && $a[1] eq $b[1] && $a[2] eq $b[2]);
}
@@ -413,7 +413,7 @@ sub debarch_is($$)
my @real = debarch_to_debtriplet($real);
my @alias = debwildcard_to_debtriplet($alias);
- return 0 if grep(!defined, (@real, @alias)) or !scalar(@real) or
!scalar(@alias);
+ return 0 if scalar @real != 3 or scalar @alias != 3;
if (($alias[0] eq $real[0] || $alias[0] eq 'any') &&
($alias[1] eq $real[1] || $alias[1] eq 'any') &&
@@ -432,7 +432,7 @@ sub debarch_is_wildcard($)
my @triplet = debwildcard_to_debtriplet($arch);
- return 0 unless defined $triplet[0];
+ return 0 if scalar @triplet != 3;
return 1 if (grep { $_ eq 'any' } @triplet);
return 0;
}
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]