From dec77ba4409afa97f4833e77c5557b3bf06bc883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Tue, 16 Apr 2024 17:08:30 +0200 Subject: [PATCH] Grow memory if applying a query after increasing a number of available packages Resolves: RHEL-27657 --- 0009-Replace-assert-by-map_grow.patch | 38 +++++++++++++++++++++++++++ libdnf.spec | 7 ++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 0009-Replace-assert-by-map_grow.patch diff --git a/0009-Replace-assert-by-map_grow.patch b/0009-Replace-assert-by-map_grow.patch new file mode 100644 index 0000000..b61b3bf --- /dev/null +++ b/0009-Replace-assert-by-map_grow.patch @@ -0,0 +1,38 @@ +From 3c5641a9c7c416e387a54eaf7dad7c33db52b0ec Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Wed, 6 Mar 2024 07:46:34 +0100 +Subject: [PATCH] Replace assert by map_grow +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream commit: ef8ac7fcedea1ec87dd3149ce1abdf8daeee25b9 + +It will make code prepared for situation when number of solvables +is increased after query is created and applied. + +The issue can be easilly triggered by adding remote RPMs therefore +the patch fixes a standard situation + +Resolves: https://issues.redhat.com/browse/RHEL-27657 +Signed-off-by: Petr Písař +--- + libdnf/sack/query.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libdnf/sack/query.cpp b/libdnf/sack/query.cpp +index 79377703..6eecfa50 100644 +--- a/libdnf/sack/query.cpp ++++ b/libdnf/sack/query.cpp +@@ -2313,7 +2313,7 @@ Query::Impl::apply() + if (!result) + initResult(); + map_init(&m, pool->nsolvables); +- assert(m.size == result->getMap()->size); ++ map_grow(result->getMap(), pool->nsolvables); + for (auto f : filters) { + map_empty(&m); + switch (f.getKeyname()) { +-- +2.44.0 + diff --git a/libdnf.spec b/libdnf.spec index f9e0177..739ed2e 100644 --- a/libdnf.spec +++ b/libdnf.spec @@ -58,7 +58,7 @@ Name: libdnf Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version} -Release: 8%{?dist} +Release: 9%{?dist} Summary: Library providing simplified C and Python API to libsolv License: LGPLv2+ URL: https://github.com/rpm-software-management/libdnf @@ -71,6 +71,7 @@ Patch5: 0005-filterAdvisory-installed_solvables-sort-RhBug2212838.patch Patch6: 0006-hawkeysubject-get_best_selectors-only-obsol-oflatest.patch Patch7: 0007-Avoid-reinstal-installonly-packages-marked-for-ERASE.patch Patch8: 0008-PGP-Set-a-default-creation-SELinux-labels-on-GnuPG-d.patch +Patch9: 0009-Replace-assert-by-map_grow.patch BuildRequires: cmake @@ -320,6 +321,10 @@ popd %endif %changelog +* Tue Apr 16 2024 Petr Pisar - 0.69.0-9 +- Grow memory if applying a query after increasing a number of available + packages (RHEL-27657) + * Wed Oct 25 2023 Petr Pisar - 0.69.0-8 - Set default SELinux labels on GnuPG directories (RHEL-11238)