[PackageKit] Backport a patch from master to fix a crash when getting package history
Richard Hughes
rhughes at fedoraproject.org
Tue Dec 3 09:28:05 UTC 2013
commit e9657c296fe595cc837a03306c59c20638420cf7
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Dec 3 09:27:52 2013 +0000
Backport a patch from master to fix a crash when getting package history
...assert-when-re-using-a-PkPackage-instance.patch | 74 ++++++++++++++++++++
PackageKit.spec | 10 +++-
2 files changed, 83 insertions(+), 1 deletions(-)
---
diff --git a/0001-Do-not-assert-when-re-using-a-PkPackage-instance.patch b/0001-Do-not-assert-when-re-using-a-PkPackage-instance.patch
new file mode 100644
index 0000000..5514d24
--- /dev/null
+++ b/0001-Do-not-assert-when-re-using-a-PkPackage-instance.patch
@@ -0,0 +1,74 @@
+From 9a6e31aac2ddf6c4bd28c70c60b333e81680ef3c Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard at hughsie.com>
+Date: Tue, 3 Dec 2013 09:22:12 +0000
+Subject: [PATCH] Do not assert when re-using a PkPackage instance
+
+This fixes commit 8d26af195536cd50f5cd8e6124df4439bb21d287 which added the
+additional restriction that the PkPackage couldn't be re-used. This restriction
+made the daemon crash when getting package history in gnome-software.
+
+Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1036837
+---
+ lib/packagekit-glib2/pk-package.c | 5 ++++-
+ lib/packagekit-glib2/pk-self-test.c | 8 --------
+ 2 files changed, 4 insertions(+), 9 deletions(-)
+
+diff --git a/lib/packagekit-glib2/pk-package.c b/lib/packagekit-glib2/pk-package.c
+index beaad5f..a9560bb 100644
+--- a/lib/packagekit-glib2/pk-package.c
++++ b/lib/packagekit-glib2/pk-package.c
+@@ -166,7 +166,10 @@ pk_package_set_id (PkPackage *package, const gchar *package_id, GError **error)
+
+ g_return_val_if_fail (PK_IS_PACKAGE (package), FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+- g_return_val_if_fail (priv->package_id == NULL, FALSE);
++
++ /* free old data */
++ g_free (priv->package_id);
++ g_free (priv->package_id_data);
+
+ /* copy the package-id into package_id_data, change the ';' into '\0'
+ * and reference the pointers in the const gchar * array */
+diff --git a/lib/packagekit-glib2/pk-self-test.c b/lib/packagekit-glib2/pk-self-test.c
+index 753810d..a5e139c 100644
+--- a/lib/packagekit-glib2/pk-self-test.c
++++ b/lib/packagekit-glib2/pk-self-test.c
+@@ -1937,35 +1937,27 @@ pk_test_package_func (void)
+ ret = pk_package_set_id (package, "gnome-power-manager", &error);
+ g_assert_error (error, 1, 0);
+ g_assert (!ret);
+- g_object_unref (package);
+ g_clear_error (&error);
+
+ /* set invalid id (sections) */
+- package = pk_package_new ();
+ ret = pk_package_set_id (package, "gnome-power-manager;0.1.2;i386", &error);
+ g_assert_error (error, 1, 0);
+ g_assert (!ret);
+- g_object_unref (package);
+ g_clear_error (&error);
+
+ /* set invalid id (sections) */
+- package = pk_package_new ();
+ ret = pk_package_set_id (package, "gnome-power-manager;0.1.2;i386;fedora;dave", &error);
+ g_assert_error (error, 1, 0);
+ g_assert (!ret);
+- g_object_unref (package);
+ g_clear_error (&error);
+
+ /* set invalid name */
+- package = pk_package_new ();
+ ret = pk_package_set_id (package, ";0.1.2;i386;fedora", &error);
+ g_assert_error (error, 1, 0);
+ g_assert (!ret);
+- g_object_unref (package);
+ g_clear_error (&error);
+
+ /* set valid name */
+- package = pk_package_new ();
+ ret = pk_package_set_id (package, "gnome-power-manager;0.1.2;i386;fedora", &error);
+ g_assert_no_error (error);
+ g_assert (ret);
+--
+1.8.4.2
+
diff --git a/PackageKit.spec b/PackageKit.spec
index 2554da6..cbf8715 100644
--- a/PackageKit.spec
+++ b/PackageKit.spec
@@ -6,7 +6,7 @@
Summary: Package management service
Name: PackageKit
Version: 0.8.14
-Release: 1%{?dist}
+Release: 2%{?dist}
License: GPLv2+ and LGPLv2+
URL: http://www.packagekit.org
Source0: http://www.packagekit.org/releases/%{name}-%{version}.tar.xz
@@ -17,6 +17,9 @@ Patch0: PackageKit-0.3.8-Fedora-Vendor.conf.patch
# Upstreamable? allow use of xulrunner2 for browser-plugin support
Patch4: PackageKit-0.7.4-xulrunner2.patch
+# Upstream already
+Patch5: 0001-Do-not-assert-when-re-using-a-PkPackage-instance.patch
+
Requires: %{name}-glib%{?_isa} = %{version}-%{release}
Requires: PackageKit-backend
Requires: shared-mime-info
@@ -228,6 +231,7 @@ using PackageKit.
%setup -q
%patch0 -p1 -b .fedora
%patch4 -p1 -b .xulrunner2
+%patch5 -p1 -b .no-history-crash
NOCONFIGURE=1 ./autogen.sh
@@ -409,6 +413,10 @@ systemctl enable packagekit-offline-update.service &> /dev/null || :
%{_libdir}/pkgconfig/packagekit-plugin.pc
%changelog
+* Tue Dec 03 2013 Richard Hughes <rhughes at redhat.com> - 0.8.14-2
+- Backport a patch from master to fix a crash when getting package history
+- Resolves: #1036837
+
* Mon Dec 02 2013 Richard Hughes <rhughes at redhat.com> - 0.8.14-1
- New upstream release
- Cache the loaded hawkey sacks to save 280ms for repeat transactions
More information about the scm-commits
mailing list