Bläddra i källkod

Dpkg::Deps: fix simplification logic of union dependencies

The code merging dependencies was wrongly updating the dependency that's
not integrated in the resulting field.

Reported-by: Andreas Metzler <ametzler@downhill.at.eu.org>
Raphaël Hertzog 15 år sedan
förälder
incheckning
5c1da3f8c2
3 ändrade filer med 9 tillägg och 4 borttagningar
  1. 1 0
      debian/changelog
  2. 3 3
      scripts/Dpkg/Deps.pm
  3. 5 1
      scripts/t/400_Dpkg_Deps.t

+ 1 - 0
debian/changelog

@@ -98,6 +98,7 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Fix possible segfault of dpkg in findbreakcycle(). LP: #733414
   * dpkg-source now properly cleans up the temporary tarball generated for
     native formats in case of unexpected interruption. Closes: #631494
+  * Fix simplification logic of union dependencies. Closes: #637564
 
   [ Guillem Jover ]
   * Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520

+ 3 - 3
scripts/Dpkg/Deps.pm

@@ -1118,11 +1118,11 @@ sub simplify_deps {
 
 WHILELOOP:
     while (@{$self->{list}}) {
-	my $dep = shift @{$self->{list}};
-	foreach my $odep (@new) {
+	my $odep = shift @{$self->{list}};
+	foreach my $dep (@new) {
 	    next WHILELOOP if $dep->merge_union($odep);
 	}
-	push @new, $dep;
+	push @new, $odep;
     }
     $self->{list} = [ @new ];
 }

+ 5 - 1
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 => 17;
+use Test::More tests => 18;
 
 use strict;
 use warnings;
@@ -66,6 +66,10 @@ my $dep_dup_union = deps_parse($field_dup_union, union => 1);
 $dep_dup_union->simplify_deps($facts);
 is($dep_dup_union->output(), "libc6 (>> 2.3), fake (<< 2.0), fake (>> 3.0), fake (= 2.5), python (<< 2.5)", "Simplify union deps");
 
+$dep_dup_union = deps_parse("sipsak (<= 0.9.6-2.1), sipsak (<= 0.9.6-2.2)", union => 1);
+$dep_dup_union->simplify_deps($facts);
+is($dep_dup_union->output(), "sipsak (<= 0.9.6-2.2)", "Simplify union deps 2");
+
 my $dep_red = deps_parse("abc | xyz, two, abc");
 $dep_red->simplify_deps($facts, $dep_opposite);
 is($dep_red->output(), "abc, two", "Simplification respect order");