Backport PR #585 for an update crash bug (#1629340)

This commit is contained in:
Adam Williamson 2018-09-18 15:35:00 -07:00
parent 492615870c
commit 7307bfb7ba
2 changed files with 41 additions and 1 deletions

34
585.patch Normal file
View File

@ -0,0 +1,34 @@
From 8e16fa3adc4ae1c3657956eef5eee5b40d1208c0 Mon Sep 17 00:00:00 2001
From: Daniel Mach <dmach@redhat.com>
Date: Tue, 18 Sep 2018 21:42:03 +0200
Subject: [PATCH] [transaction] Skip storing some obsoletes in the history
database.
---
libdnf/dnf-transaction.cpp | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/libdnf/dnf-transaction.cpp b/libdnf/dnf-transaction.cpp
index 28d15d803..638b0640a 100644
--- a/libdnf/dnf-transaction.cpp
+++ b/libdnf/dnf-transaction.cpp
@@ -1258,6 +1258,19 @@ dnf_transaction_commit(DnfTransaction *transaction, HyGoal goal, DnfState *state
}
}
+ if (swdbAction == libdnf::TransactionItemAction::OBSOLETED
+ && dnf_find_pkg_from_name(priv->install, pkg_tmp_name) != NULL
+ && g_strcmp0(pkg_name, pkg_tmp_name) != 0) {
+ // If a package is obsoleted and there's a package with the same name
+ // in the install set, skip recording the obsolete in the history db
+ // because the package upgrade prevails over the obsolete.
+ //
+ // Example:
+ // grub2-tools-efi obsoletes grub2-tools # skip as grub2-tools is also upgraded
+ // grub2-tools upgrades grub2-tools
+ continue;
+ }
+
// TODO SWDB add pkg_tmp replaced_by pkg
_history_write_item(pkg_tmp, priv->swdb, swdbAction);
}

View File

@ -24,7 +24,7 @@
Name: libdnf
Version: 0.19.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Library providing simplified C and Python API to libsolv
License: LGPLv2+
URL: https://github.com/rpm-software-management/libdnf
@ -32,6 +32,9 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# https://bugzilla.redhat.com/show_bug.cgi?id=1626851
Patch1: 0001-db-Don-t-crash-when-a-package-has-no-origin.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1629340
# https://github.com/rpm-software-management/libdnf/pull/585
Patch2: 585.patch
BuildRequires: cmake
BuildRequires: gcc
@ -224,6 +227,9 @@ popd
%endif
%changelog
* Tue Sep 18 2018 Adam Williamson <awilliam@redhat.com> - 0.19.1-3
- Backport PR #585 for an update crash bug (#1629340)
* Fri Sep 14 2018 Kalev Lember <klember@redhat.com> - 0.19.1-2
- Backport a fix for a packagekit crasher / F29 Beta blocker (#1626851)