Skip to content

Commit

Permalink
filterAdvisory: match installed_solvables sort with lower_bound (RhBu…
Browse files Browse the repository at this point in the history
…g:2212838)

`std::lower_bound` expects that the range it operates on is sorted by
the provided comparator.

`lower_bound()` is used on `installed_solvables` twice, first with
comparator `NameSolvableComparator` and later with
`SolvableCompareAdvisoryPkgNameArch` to cover both we need to sort
`installed_solvables` by name and arch.

Otherwise this can lead to problems if multiple architectures of a pkg
are installed.

For: https://bugzilla.redhat.com/show_bug.cgi?id=2212838
  • Loading branch information
kontura authored and jan-kolarik committed Sep 1, 2023
1 parent 31ed3e7 commit 4b693b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libdnf/sack/query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,7 +1903,7 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname)
while ((installed_id = installed.pImpl->result->next(installed_id)) != -1) {
installed_solvables.push_back(pool_id2solvable(pool, installed_id));
}
std::sort(installed_solvables.begin(), installed_solvables.end(), NameSolvableComparator);
std::sort(installed_solvables.begin(), installed_solvables.end(), NameArchSolvableComparator);

Query obsoletes(sack, ExcludeFlags::IGNORE_EXCLUDES);
obsoletes.addFilter(HY_PKG, HY_EQ, resultPset);
Expand Down

0 comments on commit 4b693b1

Please sign in to comment.