Backport a fix for a packagekit crasher / F29 Beta blocker (#1626851)

QA asked me to do a build with what's in stable (libdnf-0.17.0-2.fc29) +
the crasher fix, so I'm abusing git merge a bit to get bug fixes on top
of an older build.
This commit is contained in:
Kalev Lember 2018-09-12 22:07:11 +02:00
parent 42ddc3a9da
commit 4e9f5de55c
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From ccf8b4945ba6a7c888237ff0b439153b79740d80 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Wed, 12 Sep 2018 15:24:05 +0200
Subject: [PATCH] db: Don't crash when a package has no origin
This fixes a NULL pointer dereference in a debug print that was causing
packagekitd crashes.
https://bugzilla.redhat.com/show_bug.cgi?id=1626851
---
libdnf/dnf-db.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libdnf/dnf-db.cpp b/libdnf/dnf-db.cpp
index 5b28288f..894703d3 100644
--- a/libdnf/dnf-db.cpp
+++ b/libdnf/dnf-db.cpp
@@ -36,8 +36,6 @@
void
dnf_db_ensure_origin_pkg(DnfDb *db, DnfPackage *pkg)
{
- g_autoptr(GError) error = NULL;
-
/* already set */
if (dnf_package_get_origin(pkg) != NULL)
return;
@@ -47,7 +45,7 @@ dnf_db_ensure_origin_pkg(DnfDb *db, DnfPackage *pkg)
/* set from the database if available */
auto tmp = db->getRPMRepo(dnf_package_get_nevra(pkg));
if (tmp.empty()) {
- g_debug("no origin for %s: %s", dnf_package_get_package_id(pkg), error->message);
+ g_debug("no origin for %s", dnf_package_get_package_id(pkg));
} else {
dnf_package_set_origin(pkg, tmp.c_str());
}
--
2.19.0.rc0

View File

@ -24,7 +24,7 @@
Name: libdnf
Version: 0.17.0
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
@ -35,6 +35,9 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# https://github.com/rpm-software-management/libdnf/pull/546
Patch0: 0001-transaction-Fix-crash-after-using-dnf.comps.CompsQue.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1626851
Patch1: 0001-db-Don-t-crash-when-a-package-has-no-origin.patch
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
@ -219,6 +222,9 @@ popd
%endif
%changelog
* Fri Aug 10 2018 Kalev Lember <klember@redhat.com> - 0.17.0-3
- Backport a fix for a packagekit crasher / F29 Beta blocker (#1626851)
* Fri Aug 10 2018 Adam Williamson <awilliam@redhat.com> - 0.17.0-2
- Backport fix that prevented anaconda running dnf in a subprocess (#546)