summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2019-05-15 13:51:19 +0300
committerPanu Matilainen <pmatilai@redhat.com>2020-03-26 11:57:58 +0200
commit563467fe283883eb1b8bc3fad7693315c21d7b0f (patch)
treeca6d380f8b27b54f58a7f1c70c7ff118a4778d2b
parent54ec98e696178dd017f00aad539a2013561621ea (diff)
downloadrpm-563467fe283883eb1b8bc3fad7693315c21d7b0f.tar.gz
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) (cherry picked from commit a144c29831a39ed303d6ea8d2ae91e1c36d64c84)
-rw-r--r--lib/depends.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/depends.c b/lib/depends.c
index 9f4db8fa9..094864fde 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;
}