diff --git a/SOURCES/0001-Fix-packages-getting-erased-on-failed-update-with-dn.patch b/SOURCES/0001-Fix-packages-getting-erased-on-failed-update-with-dn.patch new file mode 100644 index 0000000..c1dfffe --- /dev/null +++ b/SOURCES/0001-Fix-packages-getting-erased-on-failed-update-with-dn.patch @@ -0,0 +1,39 @@ +From a144c29831a39ed303d6ea8d2ae91e1c36d64c84 Mon Sep 17 00:00:00 2001 +Message-Id: +From: Panu Matilainen +Date: Wed, 15 May 2019 13:51:19 +0300 +Subject: [PATCH] Fix packages getting erased on failed update with dnf + (RhBug:1620275) + +When adding update elements, we set the erase element to depend on the +install element, but if an API user adds the same erasure manually +after adding the update, we know its a duplicate erasure and filter +it out, BUT we zero out the dependent element in the process. And +if installing the update now fails, we end up removing the whole package +due to that missing dependent element. + +This never happens with rpm itself so we can't easily test it, but is +100% reproducable with dnf (at least dnf 3-4). Apparently it adds all +erasures by itself (which is kind of understandable I guess, perhaps +we should better allow this in the API) +--- + lib/depends.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/depends.c b/lib/depends.c +index 6e9866eae..f8a6084ab 100644 +--- a/lib/depends.c ++++ b/lib/depends.c +@@ -121,7 +121,8 @@ static int removePackage(rpmts ts, Header h, rpmte depends) + + /* Filter out duplicate erasures. */ + if (packageHashGetEntry(tsmem->removedPackages, dboffset, &pp, NULL, NULL)) { +- rpmteSetDependsOn(pp[0], depends); ++ if (depends) ++ rpmteSetDependsOn(pp[0], depends); + return 0; + } + +-- +2.21.0 + diff --git a/SPECS/rpm.spec b/SPECS/rpm.spec index a0093a3..6957894 100644 --- a/SPECS/rpm.spec +++ b/SPECS/rpm.spec @@ -30,7 +30,7 @@ %global rpmver 4.14.2 #global snapver rc2 -%global rel 9 +%global rel 10 %global srcver %{version}%{?snapver:-%{snapver}} %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x} @@ -77,6 +77,7 @@ Patch101: rpm-4.14.2-RPMTAG_MODULARITYLABEL.patch Patch102: 0001-Document-noverify-in-the-man-page-RhBug-1646458.patch Patch103: 0001-Handle-unsupported-digests-the-same-as-disabled-ones.patch Patch104: 0001-Mark-elements-with-associated-problems-as-failed.patch +Patch105: 0001-Fix-packages-getting-erased-on-failed-update-with-dn.patch # These are not yet upstream # Audit support @@ -616,6 +617,9 @@ make check || cat tests/rpmtests.log %doc doc/librpm/html/* %changelog +* Wed Jun 12 2019 Panu Matilainen - 4.14.2-10 +- Fix packages getting removed on failed update via dnf (#1718236) + * Thu Dec 20 2018 Panu Matilainen - 4.14.2-9 - Mark elements with associated problems as failed (needed for audit)