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

Bug#657695: apt: gives up too easily when resolving Breaks of virtual packages



Package: apt
Version: 0.8.16~exp9
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch precise

If a package Breaks a virtual package with many providers, and the
appropriate resolver action is to remove several of those providers,
then the resolver goes round one iteration of its master loop - which
has a hard limit of 10 iterations, so they are in short supply - per
provider.  This is not the case for Conflicts, where it deals with all
the providers in a single iteration of the master loop.

There seems no obvious reason for this discrepancy, and I think it was
an oversight when Breaks support was introduced in apt.

An example of a failed upgrade resolution due to this bug is here:

  https://bugs.launchpad.net/ubuntu/+source/apt/+bug/922485

You can see it working its way through xserver-xorg-core's Breaks on
xserver-xorg-video-6 one package at a time and eventually running out of
iterations, when it would have succeeded if it had got round to
processing all the providers.

The following patch fixes this:

=== modified file 'apt-pkg/algorithms.cc'
--- apt-pkg/algorithms.cc	2011-11-10 15:56:21 +0000
+++ apt-pkg/algorithms.cc	2012-01-28 01:44:53 +0000
@@ -1098,8 +1098,7 @@ bool pkgProblemResolver::ResolveInternal
 		  LEnd->Dep = End;
 		  LEnd++;
 		  
-		  if (Start->Type != pkgCache::Dep::Conflicts &&
-		      Start->Type != pkgCache::Dep::Obsoletes)
+		  if (Start.IsNegative() == false)
 		     break;
 	       }
 	    }

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]



Reply to: