Subject: apt: Apt fails to choose a virtual package provider in a complex 
dependency tree
Package: apt
Version: 0.7.14ubuntu6.1
Severity: normal

*** Please type your report below this line ***

With certain dependency tree apt fails to resolve dependency problem with when 
there is more than 2 providers for a virtual package. There needs to be a top 
level package that depends on so called selector package. The selector package 
depends on any concrete package of type a, b or c. Concrete packages all 
provide and conflict a virtual package. Each concrete package depends on leaf 
package leaf-a, leaf-b or leaf-c respectively. All leaf packages provide and 
conflict with same virtual package.

When trying to install packages with top-level package and using leaf package 
to select 'type' of packages the dependency resolution algorithm fails. This is 
because problem resolution algorithm does not choose highest scored provider 
but chooses first available provider that is not same as the provider that 
caused the conflict. This means that 2 cases out of 3 or more will work, but 
not the rest of the cases.

The problem can be solved by adding highest score consideration when choosing 
provider. Problem is a bit similar to #473247, but does not solve that. 
Problems are both caused because score (priority) is not considered by apt. But 
they occur in different phase of package installation process.

Here is description of package dependencies.


               [top]            (Depends: selector)
                 |
             [selector]         (Depends: a | b | c)
             /   |   \    
           [a]  [b]  [c]        (Provides: middle and Conflicts: middle)
           /     |     \
     [leaf-a] [leaf-b] [leaf-c] (Provides: leaf and Conflicts: leaf)

Example of failing command is $ apt-get install -s top leaf-a

The output is following:

r...@mika-desktop:/# apt-get install -s top leaf-b
Reading package lists... Done 
Building dependency tree Reading state information... Done 
Some packages could not be installed. This may mean that you have 
requested an impossible situation or if you are using the unstable 
distribution that some required packages have not yet been created 
or been moved out of Incoming.

The following information may help to resolve the situation:


The following packages have unmet dependencies:
  top: Depends: selector but it is not going to be installed
E: Broken packages
r...@mika-desktop:/#


I am attaching a patch that fixes this problem in conflict resolution 
algorithm. The match makes the algorithm consider scores when choosing provider 
for a virtual package.


-- Package-specific info:
-- (no /etc/apt/preferences present) --


-- (/etc/apt/sources.list present, but not submitted) --


-- System Information:
Debian Release: lenny/sid
  APT prefers intrepid-updates
  APT policy: (500, 'intrepid-updates'), (500, 'intrepid-security'), (500, 
'intrepid')
Architecture: i386 (i686)

Kernel: Linux 2.6.27-16-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt depends on:
ii  libc6              2.8~20080505-0ubuntu9 GNU C Library: Shared libraries
ii  libgcc1            1:4.3.2-1ubuntu12     GCC support library
ii  libstdc++6         4.3.2-1ubuntu12       The GNU Standard C++ Library v3

Versions of packages apt recommends:
ii  ubuntu-keyring                2008.03.04 GnuPG keys of the Ubuntu archive

-- no debconf information

Attachment: apt_0.7.14ubuntu6.1.diff
Description: apt_0.7.14ubuntu6.1.diff

Reply via email to