|
|
10b4de |
From dd4862b4ff957ad2e535ace32a2f38706da64793 Mon Sep 17 00:00:00 2001
|
|
|
10b4de |
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
|
|
10b4de |
Date: Mon, 30 May 2022 08:59:41 +0200
|
|
|
10b4de |
Subject: [PATCH] advisory upgrade: filter out advPkgs with different arch
|
|
|
10b4de |
|
|
|
10b4de |
This prevents a situation in security upgrades where libsolv cannot
|
|
|
10b4de |
upgrade dependent pkgs because we ask for an upgrade of different arch:
|
|
|
10b4de |
|
|
|
10b4de |
We can get the following testcase if libdnf has filtered out
|
|
|
10b4de |
json-c-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms
|
|
|
10b4de |
(because there is an advisory for already installed json-c-1-1.el8.x86_64) but
|
|
|
10b4de |
json-c-2-2.el8.i686@rhel-8-for-x86_64-baseos-rpms is not filtered out because
|
|
|
10b4de |
it has different architecture. The resulting transaction doesn't work.
|
|
|
10b4de |
|
|
|
10b4de |
```
|
|
|
10b4de |
repo @System -99.-1000 testtags <inline>
|
|
|
10b4de |
#>=Pkg: bind-libs-lite 1 1.el8 x86_64
|
|
|
10b4de |
#>=Pkg: json-c 1 1.el8 x86_64
|
|
|
10b4de |
|
|
|
10b4de |
repo rhel-8-for-x86_64-baseos-rpms -99.-1000 testtags <inline>
|
|
|
10b4de |
#>=Pkg: json-c 2 2.el8 x86_64
|
|
|
10b4de |
#>=Prv: libjson-c.so.4()(64bit)
|
|
|
10b4de |
#>
|
|
|
10b4de |
#>=Pkg: json-c 2 2.el8 i686
|
|
|
10b4de |
#>=Prv: libjson-c.so.4()
|
|
|
10b4de |
#>
|
|
|
10b4de |
#>=Pkg: bind-libs-lite 2 2.el8 x86_64
|
|
|
10b4de |
#>=Req: libjson-c.so.4()(64bit)
|
|
|
10b4de |
system x86_64 rpm @System
|
|
|
10b4de |
job update oneof json-c-1-1.el8.x86_64@@System json-c-2-2.el8.i686@rhel-8-for-x86_64-baseos-rpms bind-libs-lite-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms [forcebest,targeted,setevr,setarch]
|
|
|
10b4de |
result transaction,problems <inline>
|
|
|
10b4de |
#>problem f06d81a4 info package bind-libs-lite-2-2.el8.x86_64 requires libjson-c.so.4()(64bit), but none of the providers can be installed
|
|
|
10b4de |
#>problem f06d81a4 solution 96f9031b allow bind-libs-lite-1-1.el8.x86_64@@System
|
|
|
10b4de |
#>problem f06d81a4 solution c8daf94f allow json-c-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms
|
|
|
10b4de |
#>upgrade bind-libs-lite-1-1.el8.x86_64@@System bind-libs-lite-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms
|
|
|
10b4de |
#>upgrade json-c-1-1.el8.x86_64@@System json-c-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms```
|
|
|
10b4de |
```
|
|
|
10b4de |
|
|
|
10b4de |
= changelog =
|
|
|
10b4de |
msg: Filter out advisory pkgs with different arch during advisory upgrade, fixes possible problems in dependency resulution.
|
|
|
10b4de |
type: bugfix
|
|
|
10b4de |
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2088149
|
|
|
10b4de |
---
|
|
|
10b4de |
libdnf/sack/query.cpp | 25 +++++++++++++++++++------
|
|
|
10b4de |
1 file changed, 19 insertions(+), 6 deletions(-)
|
|
|
10b4de |
|
|
|
10b4de |
diff --git a/libdnf/sack/query.cpp b/libdnf/sack/query.cpp
|
|
|
10b4de |
index ac2736b5..03d39659 100644
|
|
|
10b4de |
--- a/libdnf/sack/query.cpp
|
|
|
10b4de |
+++ b/libdnf/sack/query.cpp
|
|
|
10b4de |
@@ -1877,12 +1877,6 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname)
|
|
|
10b4de |
std::vector<Solvable *> candidates;
|
|
|
10b4de |
std::vector<Solvable *> installed_solvables;
|
|
|
10b4de |
|
|
|
10b4de |
- Id id = -1;
|
|
|
10b4de |
- while ((id = resultPset->next(id)) != -1) {
|
|
|
10b4de |
- candidates.push_back(pool_id2solvable(pool, id));
|
|
|
10b4de |
- }
|
|
|
10b4de |
- NameArchEVRComparator cmp_key(pool);
|
|
|
10b4de |
-
|
|
|
10b4de |
if (cmp_type & HY_UPGRADE) {
|
|
|
10b4de |
Query installed(sack, ExcludeFlags::IGNORE_EXCLUDES);
|
|
|
10b4de |
installed.installed();
|
|
|
10b4de |
@@ -1893,6 +1887,18 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname)
|
|
|
10b4de |
installed_solvables.push_back(pool_id2solvable(pool, installed_id));
|
|
|
10b4de |
}
|
|
|
10b4de |
std::sort(installed_solvables.begin(), installed_solvables.end(), NameArchSolvableComparator);
|
|
|
10b4de |
+ Id id = -1;
|
|
|
10b4de |
+ while ((id = resultPset->next(id)) != -1) {
|
|
|
10b4de |
+ Solvable * s = pool_id2solvable(pool, id);
|
|
|
10b4de |
+ // When doing HY_UPGRADE consider only candidate pkgs that have matching Name and Arch
|
|
|
10b4de |
+ // with some already installed pkg (in other words: some other version of the pkg is already installed).
|
|
|
10b4de |
+ // Otherwise a pkg with different Arch than installed can end up in upgrade set which is wrong.
|
|
|
10b4de |
+ // It can result in dependency issues, reported as: RhBug:2088149.
|
|
|
10b4de |
+ auto low = std::lower_bound(installed_solvables.begin(), installed_solvables.end(), s, NameArchSolvableComparator);
|
|
|
10b4de |
+ if (low != installed_solvables.end() && s->name == (*low)->name && s->arch == (*low)->arch) {
|
|
|
10b4de |
+ candidates.push_back(s);
|
|
|
10b4de |
+ }
|
|
|
10b4de |
+ }
|
|
|
10b4de |
|
|
|
10b4de |
// Apply security filters only to packages with lower priority - to unify behaviour upgrade
|
|
|
10b4de |
// and upgrade-minimal
|
|
|
10b4de |
@@ -1915,7 +1921,14 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname)
|
|
|
10b4de |
}
|
|
|
10b4de |
}
|
|
|
10b4de |
std::swap(candidates, priority_candidates);
|
|
|
10b4de |
+ } else {
|
|
|
10b4de |
+ Id id = -1;
|
|
|
10b4de |
+ while ((id = resultPset->next(id)) != -1) {
|
|
|
10b4de |
+ candidates.push_back(pool_id2solvable(pool, id));
|
|
|
10b4de |
+ }
|
|
|
10b4de |
}
|
|
|
10b4de |
+
|
|
|
10b4de |
+ NameArchEVRComparator cmp_key(pool);
|
|
|
10b4de |
std::sort(candidates.begin(), candidates.end(), cmp_key);
|
|
|
10b4de |
for (auto & advisoryPkg : pkgs) {
|
|
|
10b4de |
if (cmp_type & HY_UPGRADE) {
|
|
|
10b4de |
--
|
|
|
10b4de |
2.36.1
|
|
|
10b4de |
|