[Aptitude-devel] Bug#847089: aptitude: resolver mishandles OR'ed versioned Recommends

Manuel A. Fernandez Montecelo manuel.montezelo at gmail.com
Fri Apr 14 18:23:36 UTC 2017


Control: tags -1 + moreinfo

(tagging moreinfo to set it aside from untriaged reports and indicating
that it needs further consideration, but not --necessarily-- more info
from the submitter)


Hi,

2016-12-05 14:26 Vincent Lefevre:
>Package: aptitude
>Version: 0.8.3-1+b2
>Severity: normal
>
>TD;LR
>To satisfy an OR'ed versioned Recommends, the resolver should prefer
>a package upgrade over a new package installation (which may yield a
>conflict with the other choice), even though this is not the first
>choice.
>
>I have:
>
>  --\ utils          Various system utilities (5)
>    --\ main           The main Debian archive (5)
>i A stardict-common            3.0.1-9.2                3.0.1-9.3
>i   stardict-gtk               3.0.1-9.2+b2             3.0.1-9.3
>i A stardict-plugin            3.0.1-9.2+b2             3.0.1-9.3
>i A stardict-plugin-           3.0.1-9.2+b2             3.0.1-9.3
>i A stardict-plugin-           3.0.1-9.2+b2             3.0.1-9.3
>
>If I type '+' over "stardict-gtk", I get:
>
>  --\ utils          Various system utilities (5)
>    --\ main           The main Debian archive (5)
>iuA stardict-common  -165 kB   3.0.1-9.2                3.0.1-9.3
>iu  stardict-gtk     +31.7 kB  3.0.1-9.2+b2             3.0.1-9.3
>iuA stardict-plugin  +17.4 kB  3.0.1-9.2+b2             3.0.1-9.3
>iuA stardict-plugin- +3072 B   3.0.1-9.2+b2             3.0.1-9.3
>iuA stardict-plugin- -68.6 kB  3.0.1-9.2+b2             3.0.1-9.3
>
>i.e. the packages will be upgraded as expected (only these 5 packages,
>nothing else). This is fine.

This works fine because stardict-gtk Depends exactly on (stardict-common
= 3.0.1-9.3), and the same with Recommends and the plugins, so it's
easier for the resolution to arrive to the desired conclusion.


>But if I type '+' over "main", I get:
>
>  --\ utils          Various system utilities (5)
>    --\ main           The main Debian archive (5)
>iuA stardict-common  -165 kB   3.0.1-9.2                3.0.1-9.3
>iB  stardict-gtk     +31.7 kB  3.0.1-9.2+b2             3.0.1-9.3
>iuA stardict-plugin  +17.4 kB  3.0.1-9.2+b2             3.0.1-9.3
>iuA stardict-plugin- +3072 B   3.0.1-9.2+b2             3.0.1-9.3
>iuA stardict-plugin- -68.6 kB  3.0.1-9.2+b2             3.0.1-9.3
>
>Here the package stardict-gtk is marked as broken, while it could be
>upgraded as shown above. In the details, I get:
>
>Some dependencies of stardict-gtk (broken, 3.0.1-9.2+b2) are not satisfied:    ▒
>>  * stardict-gtk (upgrade, 3.0.1-9.2+b2 -> 3.0.1-9.3) conflicts with           ▒
>    stardict-gnome                                                             ▒
>>The following packages conflict with stardict-gtk (broken, 3.0.1-9.2+b2):      ▒
>>  * stardict-gnome (install, 3.0.1-9.3) conflicts with stardict-gtk            ▒
>
>However stardict-gnome is currently not installed!
>
>Note: the same thing occurs if I type '+' over "stardict-common".
>
>I suppose that the cause of the problem is due to an OR'ed
>versioned Recommends in stardict-common; before typing '+':
>
>  --\ Recommends (1)
>    --- stardict-gnome (>= 3.0.1-9.3) | stardict-gtk (>= 3.0.1-9.3) (UNSATISFIED)
>
>It seems that aptitude wants to satisfy the Recommends by taking the
>first choice stardict-gnome (>= 3.0.1-9.3) instead of upgrading the
>already installed package to satisfy the second choice.
>
>The problem does not occur if I ask to upgrade all the packages with
>"aptitude upgrade" or "aptitude upgrade --full-resolver", or type 'U'
>in the UI (but this is not practical when one wants to upgrade some
>packages only).
>
>Note that apt has the same problem with just
>
>  apt install stardict-common
>
>(it wants to install stardict-gnome and remove stardict-gtk), but
>not with:
>
>  apt install stardict-common stardict-gtk stardict-plugin \
>    stardict-plugin-espeak stardict-plugin-festival
>
>Ditto for "aptitude install ...". So, I wonder why typing '+' over
>"main" does not behave the same way. This may be a separate issue.

I cannot confirm 100%, but I think that your analysis is correct.

The reason why this happens when pressing '+' on "main" subtree is, I
think, because aptitude relies on apt's dependency resolution initially
(among other reasons, because it's faster), and it invokes its own
resolver when it finds conflicts or some sort of broken dependencies or
recommends.

After that, it depends on the internal machinations of aptitude's
resolver, and being guided by the different resolution strategies that
can be configured.  I've been tweaking the default parameters in the
0.8.x series so it suggests first upgrading, keeping or installing
rather than removing dozens of packages; and also trying to minimise the
number of actions; but fundamentally it is an open problem without
clear-cut solutions, so it doesn't always work.

(In the command line the aptitude resolver is used more often, or it
might be triggered before asking any question, so it offers the right
solution first or doesn't even ask.)


So if all the above is correct, it is not possible to do anything about
this unless aptitude stops relying on apt's resolution in the first
instance, which I don't think that it's a good idea; and to correct the
problems I suppose that the aptitude resolver is invoked and suggests
(or suggested) something sensible.  So I am not sure if we can do
something, or if we can, what's best.


Cheers.
-- 
Manuel A. Fernandez Montecelo <manuel.montezelo at gmail.com>



More information about the Aptitude-devel mailing list