- Fix a bug where the daemon could crash when cancelling a lot of

transactions.
- Fix installing codecs with a 64 bit machine
This commit is contained in:
Richard Hughes 2008-09-30 12:52:59 +00:00
parent 2b8fb92b5c
commit 74345b9633
3 changed files with 174 additions and 4 deletions

View File

@ -8,15 +8,18 @@
Summary: System daemon that is a DBUS abstraction layer for package management
Name: PackageKit
Version: 0.3.5
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+
Group: System Environment/Libraries
URL: http://packagekit.freedesktop.org
Source0: http://www.packagekit.org/releases/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
# upstream: c9a01198d494f06ae9e0b3e2a002f941da118f00
#Patch0: pk-dont-send-finished-from-dispatcher.patch
# upstream: 920574b72805a630ea989b32012e2b4bbf1841ea
Patch0: pk-fix-64bit-codecs.patch
# upstream: d2c3725b5414e27fa05518f04eab01ab7a0b1a89
Patch1: pk-fix-cancel-at-speed-unlucky.patch
Requires: dbus >= %{dbus_version}
Requires: dbus-glib >= %{dbus_glib_version}
@ -155,7 +158,8 @@ codecs from configured repositories using PackageKit.
%prep
%setup -q
#%patch0 -p1
%patch0 -p1
%patch1 -p1
%build
%configure --enable-yum --enable-smart --with-default-backend=yum --disable-local
@ -296,6 +300,10 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_includedir}/*
%changelog
* Tue Sep 30 2008 Richard Hughes <rhughes@redhat.com> - 0.3.5-3
- Fix a bug where the daemon could crash when cancelling a lot of transactions.
- Fix installing codecs with a 64 bit machine
* Tue Sep 30 2008 Richard Hughes <rhughes@redhat.com> - 0.3.5-2
- Obsolete more releases of codeina to fix upgrades on rawhide.

104
pk-fix-64bit-codecs.patch Normal file
View File

@ -0,0 +1,104 @@
commit 920574b72805a630ea989b32012e2b4bbf1841ea
Author: Richard Hughes <richard@hughsie.com>
Date: Tue Sep 30 13:21:08 2008 +0100
bugfix: use a ()(64bit) suffix for the package provides on 64 bit machines
diff --git a/contrib/gstreamer-plugin/pk-gstreamer-install.c b/contrib/gstreamer-plugin/pk-gstreamer-install.c
index f9ba620..a2d6602 100644
--- a/contrib/gstreamer-plugin/pk-gstreamer-install.c
+++ b/contrib/gstreamer-plugin/pk-gstreamer-install.c
@@ -22,6 +22,7 @@
#include <gst/gst.h>
#include <string.h>
+#include <sys/utsname.h>
#include <dbus/dbus-glib.h>
typedef struct {
@@ -227,6 +228,44 @@ pk_gst_codec_free (codec_info *codec)
}
/**
+ * pk_gst_get_arch_suffix:
+ *
+ * Return value: something other than blank if we are running on 64 bit.
+ **/
+static const gchar *
+pk_gst_get_arch_suffix (void)
+{
+ gint retval;
+ const gchar *suffix = "";
+ struct utsname buf;
+
+ retval = uname (&buf);
+
+ /* did we get valid value? */
+ if (retval != 0 || buf.machine == NULL) {
+ g_warning ("cannot get machine type");
+ goto out;
+ }
+
+ /* 32 bit machines */
+ if (strcmp (buf.machine, "i386") == 0 ||
+ strcmp (buf.machine, "i586") == 0 ||
+ strcmp (buf.machine, "i686") == 0)
+ goto out;
+
+ /* 64 bit machines */
+ if (strcmp (buf.machine, "x86_64") == 0) {
+ suffix = "()(64bit)";
+ goto out;
+ }
+
+ g_warning ("did not recognise machine type: '%s'", buf.machine);
+out:
+ return suffix;
+}
+
+
+/**
* main:
**/
int
@@ -245,6 +284,7 @@ main (int argc, char **argv)
gchar **codecs = NULL;
gint xid = 0;
gint retval = 1;
+ const gchar *suffix;
const GOptionEntry options[] = {
{ "transient-for", '\0', 0, G_OPTION_ARG_INT, &xid, "The XID of the parent window", NULL },
@@ -288,6 +328,8 @@ main (int argc, char **argv)
goto out;
}
+ /* use a ()(64bit) suffix for 64 bit */
+ suffix = pk_gst_get_arch_suffix ();
/* process argv */
array = g_ptr_array_new ();
@@ -301,18 +343,18 @@ main (int argc, char **argv)
g_print ("skipping %s\n", codecs[i]);
continue;
}
+ g_message ("Codec nice name: %s", info->codec_name);
if (info->structure != NULL) {
s = pk_gst_structure_to_provide (info->structure);
- type = g_strdup_printf ("gstreamer0.10(%s-%s)%s", info->type_name,
- gst_structure_get_name (info->structure), s ? s : "");
+ type = g_strdup_printf ("gstreamer0.10(%s-%s)%s%s", info->type_name,
+ gst_structure_get_name (info->structure), s, suffix);
g_free (s);
+ g_message ("structure: %s", type);
} else {
type = g_strdup_printf ("gstreamer0.10(%s)", info->type_name);
+ g_message ("non-structure: %s", type);
}
- g_message ("Codec nice name: %s", info->codec_name);
- g_message ("%s", type);
-
/* create (ss) structure */
varray = g_value_array_new (2);
value = g_new0 (GValue, 1);

View File

@ -0,0 +1,58 @@
commit d2c3725b5414e27fa05518f04eab01ab7a0b1a89
Author: Richard Hughes <hughsie@localhost.localdomain>
Date: Tue Sep 30 10:42:32 2008 +0100
bugfix: remove items about to be run from the transaction list without crashing
The daemon sometimes crashes when a large number of requests are queued and then cancelled
This is because by sheer luck (on unluckyness...) we get a request in the idle time between
the transaction being scheduled to run, and actually being run.
In this case, save the idle callback ID, and stop the callback from occurring
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index d975f6b..9470da9 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -69,6 +69,7 @@ typedef struct {
gboolean finished;
PkTransaction *transaction;
gchar *tid;
+ guint idle_id;
} PkTransactionItem;
enum {
@@ -199,6 +200,17 @@ pk_transaction_list_remove (PkTransactionList *tlist, const gchar *tid)
egg_warning ("already finished, so waiting to timeout");
return FALSE;
}
+ /* check if we are running, or _just_ about to be run */
+ if (item->running) {
+ if (item->idle_id == 0) {
+ egg_warning ("already running, but no idle_id");
+ return FALSE;
+ }
+ /* just about to be run! */
+ egg_debug ("cancelling the callback to the 'lost' transaction");
+ g_source_remove (item->idle_id);
+ item->idle_id = 0;
+ }
ret = pk_transaction_list_remove_internal (tlist, item);
return ret;
}
@@ -237,6 +249,7 @@ pk_transaction_list_run_idle_cb (PkTransactionItem *item)
egg_error ("failed to run transaction (fatal)");
/* never try to idle add this again */
+ item->idle_id = 0;
return FALSE;
}
@@ -251,7 +264,7 @@ pk_transaction_list_run_item (PkTransactionList *tlist, PkTransactionItem *item)
item->running = TRUE;
/* add this idle, so that we don't have a deep out-of-order callchain */
- g_idle_add ((GSourceFunc) pk_transaction_list_run_idle_cb, item);
+ item->idle_id = g_idle_add ((GSourceFunc) pk_transaction_list_run_idle_cb, item);
}
/**