rpm-software-management / dnf

Package manager based on libdnf and libsolv. Replaces YUM.
GNU General Public License v2.0
1.23k stars 409 forks source link

Installonly packages are not handled correctly when more architectures #2058

Open j-mracek opened 7 months ago

j-mracek commented 7 months ago

Installing of secondary architecture for kernel-core result in problem. The issue was discovered during review of https://github.com/rpm-software-management/dnf5/pull/1261.

Reproducer on vanilla system (one kernel-core.x86_64 installed and upgrade available): Install kernel-core.i686 (requires to add i386 fedora repository)

# dnf --repofrompath=test,https://sdsd.com --setopt=test.metalink='https://mirrors.fedoraproject.org/metalink?repo=updates-30&arch=i386' install kernel-core-0:5.0.9-301.fc30.i686 --nogpgcheck --setopt=installonly_limit=2

upgrade kernel-core (requires to add i386 upgrade repository)

# dnf --repofrompath=test,https://sdsd.com --setopt=test.metalink='https://mirrors.fedoraproject.org/metalink?repo=updates-released-f30&arch=i386' --nogpgcheck --setopt=installonly_limit=2 upgrade kernel-core

Result:

Error: 
 Problem: The operation would result in removing the following protected packages: kernel-core
(try to add '--skip-broken' to skip uninstallable packages)

Expected: Both kernel-core packages will be upgraded

The issue is caused by a different logic in libsolv where packages are handled per architecture (correct behavior) and our logic that handles over limit packages where it handle them per name.

Solution sort same_name_subqueue and related queue by name and architecture.