rpms/hal/F-8 hal-0.5.10-acltool-serialize.patch, NONE, 1.1 hal.spec, 1.139, 1.140 hal-0.5.10-ck-acl.patch, 1.1, NONE
Lubomir Kundrak (lkundrak)
fedora-extras-commits at redhat.com
Tue Mar 4 12:01:53 UTC 2008
- Previous message (by thread): rpms/net-tools/devel net-tools-1.60-statistics_buffer.patch, NONE, 1.1 net-tools.spec, 1.90, 1.91
- Next message (by thread): rpms/coreutils/devel coreutils-6.10-verbose.patch, 1.1, 1.2 coreutils-colorls.csh, 1.10, 1.11 coreutils.spec, 1.196, 1.197
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: lkundrak
Update of /cvs/pkgs/rpms/hal/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv18862/F-8
Modified Files:
hal.spec
Added Files:
hal-0.5.10-acltool-serialize.patch
Removed Files:
hal-0.5.10-ck-acl.patch
Log Message:
Replace my #384271 patch with David's.
Huzzzaaah!
hal-0.5.10-acltool-serialize.patch:
--- NEW FILE hal-0.5.10-acltool-serialize.patch ---
From: David Zeuthen <davidz at redhat.com>
Date: Tue, 4 Mar 2008 05:10:22 +0000 (-0500)
Subject: properly serialize the calls to 'hal-acl-tool --reconfigure'
X-Git-Url: http://gitweb.freedesktop.org/?p=hal.git;a=commitdiff;h=f047f03869b2f5d20de1eafdae02d4ebc6eddc06
properly serialize the calls to 'hal-acl-tool --reconfigure'
This fixes a long standing bug where ACL's were sometimes wrong when
VT switching and when resuming from STR or STD. The problem was that
we would get a bunch of events from ConsoleKit at once, say
1. Session1 -> Inactive
2. Session2 -> Active
3. Session2 -> Inactive
4. Session1 -> Active
So for events 1-4 we would spawn 'hal-acl-tool --reconfigure' with a
carefully prepared environment reflecting the ConsoleKit state. All
four copies would start at once and race to get the lock. Which means
that it was undefined what other they execute in.
It's very easy to reproduce this; just try running
# chvt 1; chvt 7; sleep 1; getfacl /dev/snd/pcmC0D0p
(or some other device node)
a few times and observe that sometimes you wouldn't get an ACL.
This patch serializes the events and fixes this bug.
---
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -5280,9 +5280,9 @@ local_server_message_handler (DBusConnec
GSList *i;
GSList *j;
- HAL_INFO (("************************"));
- HAL_INFO (("Client to local_server was disconnected for %x", connection));
- HAL_INFO (("************************"));
+ //HAL_INFO (("************************"));
+ //HAL_INFO (("Client to local_server was disconnected for %x", connection));
+ //HAL_INFO (("************************"));
for (i = helper_interface_handlers; i != NULL; i = j) {
HelperInterfaceHandler *hih = i->data;
@@ -5324,9 +5324,9 @@ local_server_message_handler (DBusConnec
static void
local_server_unregister_handler (DBusConnection *connection, void *user_data)
{
- HAL_INFO (("***************************"));
- HAL_INFO (("********* unregistered %x", connection));
- HAL_INFO (("***************************"));
+ //HAL_INFO (("***************************"));
+ //HAL_INFO (("********* unregistered %x", connection));
+ //HAL_INFO (("***************************"));
}
static void
@@ -5338,9 +5338,9 @@ local_server_handle_connection (DBusServ
&local_server_message_handler,
NULL, NULL, NULL, NULL};
- HAL_INFO (("***************************"));
- HAL_INFO (("********* got a connection %x", new_connection));
- HAL_INFO (("***************************"));
+ //HAL_INFO (("***************************"));
+ //HAL_INFO (("********* got a connection %x", new_connection));
+ //HAL_INFO (("***************************"));
/*dbus_connection_add_filter (new_connection, server_filter_function, NULL, NULL);*/
@@ -5405,96 +5405,6 @@ hald_dbus_local_server_shutdown (void)
#ifdef HAVE_CONKIT
static void
-hald_dbus_session_added (CKTracker *tracker, CKSession *session, void *user_data)
-{
- HalDevice *d;
- char **programs;
- char *extra_env[5] = {"HALD_ACTION=session_add",
- NULL /* "HALD_SESSION_ADD_SESSION_ID=" */,
- NULL /* "HALD_SESSION_ADD_SESSION_UID=" */,
- NULL /* "HALD_SESSION_ADD_SESSION_IS_ACTIVE=" */,
- NULL};
-
- HAL_INFO (("In hald_dbus_session_added for session '%s' on seat '%s'",
- ck_session_get_id (session),
- ck_session_get_seat (session) != NULL ? ck_seat_get_id (ck_session_get_seat (session)) : "(NONE)"));
-
- d = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer");
- if (d == NULL) {
- d = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer");
- }
- if (d == NULL) {
- goto out;
- }
-
- programs = hal_device_property_dup_strlist_as_strv (d, "info.callouts.session_add");
- if (programs == NULL) {
- goto out;
- }
-
- extra_env[1] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_ID=%s", ck_session_get_id (session));
- extra_env[2] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_UID=%d", ck_session_get_user (session));
- extra_env[3] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_IS_ACTIVE=%s",
- ck_session_is_active (session) ? "true" : "false");
- hal_callout_device (d,
- NULL /* callback */,
- NULL /* userdata1 */,
- NULL /* userdata2 */,
- programs,
- extra_env);
- g_free (extra_env[1]);
- g_free (extra_env[2]);
- g_free (extra_env[3]);
-out:
- ;
-}
-
-static void
-hald_dbus_session_removed (CKTracker *tracker, CKSession *session, void *user_data)
-{
- HalDevice *d;
- char **programs;
- char *extra_env[5] = {"HALD_ACTION=session_remove",
- NULL /* "HALD_SESSION_REMOVE_SESSION_ID=" */,
- NULL /* "HALD_SESSION_REMOVE_SESSION_UID=" */,
- NULL /* "HALD_SESSION_REMOVE_SESSION_IS_ACTIVE=" */,
- NULL};
-
- HAL_INFO (("In hald_dbus_session_removed for session '%s' on seat '%s'",
- ck_session_get_id (session),
- ck_session_get_seat (session) != NULL ? ck_seat_get_id (ck_session_get_seat (session)) : "(NONE)"));
-
- d = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer");
- if (d == NULL) {
- d = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer");
- }
- if (d == NULL) {
- goto out;
- }
-
- programs = hal_device_property_dup_strlist_as_strv (d, "info.callouts.session_remove");
- if (programs == NULL) {
- goto out;
- }
-
- extra_env[1] = g_strdup_printf ("HALD_SESSION_REMOVE_SESSION_ID=%s", ck_session_get_id (session));
- extra_env[2] = g_strdup_printf ("HALD_SESSION_REMOVE_SESSION_UID=%d", ck_session_get_user (session));
- extra_env[3] = g_strdup_printf ("HALD_SESSION_REMOVE_SESSION_IS_ACTIVE=%s",
- ck_session_is_active (session) ? "true" : "false");
- hal_callout_device (d,
- NULL /* callback */,
- NULL /* userdata1 */,
- NULL /* userdata2 */,
- programs,
- extra_env);
- g_free (extra_env[1]);
- g_free (extra_env[2]);
- g_free (extra_env[3]);
-out:
- ;
-}
-
-static void
hald_dbus_seat_added (CKTracker *tracker, CKSeat *seat, void *user_data)
{
/* TODO: we could run callouts here... but they wouldn't do anything useful right now */
@@ -5593,6 +5503,87 @@ reconfigure_all_policy (void)
reconfigure_acl ();
}
+
+typedef struct {
+ HalDevice *d;
+ char **programs;
+ char **extra_env;
+} SessionChangesEntry;
+
+static GList *session_changes_queue = NULL;
+gboolean session_changes_is_running = FALSE;
+
+static void session_changes_process_queue (void);
+
+static void
+session_changes_done_cb (HalDevice *d, gpointer userdata1, gpointer userdata2)
+{
+ SessionChangesEntry *entry = userdata1;
+
+ HAL_INFO (("session_changes_done_cb"));
+
+ g_assert (entry->d == d);
+
+ /* hal_callout_device takes ownership of entry->programs so we don't free it here */
+ g_object_unref (entry->d);
+ g_strfreev (entry->extra_env);
+ g_free (entry);
+
+ session_changes_is_running = FALSE;
+
+ session_changes_process_queue ();
+}
+
+static void
+session_changes_process_queue (void)
+{
+ SessionChangesEntry *entry;
+
+ HAL_INFO (("session_changes_process_queue"));
+
+ /* nothing to run */
+ if (session_changes_queue == NULL)
+ return;
+
+ /* something is already running; wait for it to terminate */
+ if (session_changes_is_running)
+ return;
+
+ HAL_INFO ((" running element in queue"));
+
+ /* pop the first element */
+ entry = session_changes_queue->data;
+ session_changes_queue = g_list_remove (session_changes_queue, entry);
+
+ hal_callout_device (entry->d,
+ session_changes_done_cb, /* callback */
+ entry, /* userdata1 */
+ NULL, /* userdata2 */
+ entry->programs,
+ entry->extra_env);
+
+ session_changes_is_running = TRUE;
+}
+
+static void
+session_changes_push (HalDevice *d, char **programs, char **extra_env)
+{
+ SessionChangesEntry *entry;
+
+ HAL_INFO (("session_changes_push"));
+
+ entry = g_new0 (SessionChangesEntry, 1);
+ entry->d = g_object_ref (d);
+ entry->programs = g_strdupv (programs);
+ entry->extra_env = g_strdupv (extra_env);
+
+ /* push to end of queue */
+ session_changes_queue = g_list_append (session_changes_queue, entry);
+
+ /* only process the queue if there we are the only element */
+ session_changes_process_queue ();
+}
+
static void
hald_dbus_session_active_changed (CKTracker *tracker, CKSession *session, void *user_data)
{
@@ -5631,12 +5622,93 @@ hald_dbus_session_active_changed (CKTrac
extra_env[2] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_UID=%d", ck_session_get_user (session));
extra_env[3] = g_strdup_printf ("HALD_SESSION_ACTIVE_CHANGED_SESSION_IS_ACTIVE=%s",
ck_session_is_active (session) ? "true" : "false");
- hal_callout_device (d,
- NULL /* callback */,
- NULL /* userdata1 */,
- NULL /* userdata2 */,
- programs,
- extra_env);
+
+ session_changes_push (d, programs, extra_env);
+
+ g_free (extra_env[1]);
+ g_free (extra_env[2]);
+ g_free (extra_env[3]);
+out:
+ ;
+}
+
+static void
+hald_dbus_session_added (CKTracker *tracker, CKSession *session, void *user_data)
+{
+ HalDevice *d;
+ char **programs;
+ char *extra_env[5] = {"HALD_ACTION=session_add",
+ NULL /* "HALD_SESSION_ADD_SESSION_ID=" */,
+ NULL /* "HALD_SESSION_ADD_SESSION_UID=" */,
+ NULL /* "HALD_SESSION_ADD_SESSION_IS_ACTIVE=" */,
+ NULL};
+
+ HAL_INFO (("In hald_dbus_session_added for session '%s' on seat '%s'",
+ ck_session_get_id (session),
+ ck_session_get_seat (session) != NULL ? ck_seat_get_id (ck_session_get_seat (session)) : "(NONE)"));
+
+ d = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer");
+ if (d == NULL) {
+ d = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer");
+ }
+ if (d == NULL) {
+ goto out;
+ }
+
+ programs = hal_device_property_dup_strlist_as_strv (d, "info.callouts.session_add");
+ if (programs == NULL) {
+ goto out;
+ }
+
+ extra_env[1] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_ID=%s", ck_session_get_id (session));
+ extra_env[2] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_UID=%d", ck_session_get_user (session));
+ extra_env[3] = g_strdup_printf ("HALD_SESSION_ADD_SESSION_IS_ACTIVE=%s",
+ ck_session_is_active (session) ? "true" : "false");
+
+ session_changes_push (d, programs, extra_env);
+
+ g_free (extra_env[1]);
+ g_free (extra_env[2]);
+ g_free (extra_env[3]);
+out:
+ ;
+}
+
+static void
+hald_dbus_session_removed (CKTracker *tracker, CKSession *session, void *user_data)
+{
+ HalDevice *d;
+ char **programs;
+ char *extra_env[5] = {"HALD_ACTION=session_remove",
+ NULL /* "HALD_SESSION_REMOVE_SESSION_ID=" */,
+ NULL /* "HALD_SESSION_REMOVE_SESSION_UID=" */,
+ NULL /* "HALD_SESSION_REMOVE_SESSION_IS_ACTIVE=" */,
+ NULL};
+
+ HAL_INFO (("In hald_dbus_session_removed for session '%s' on seat '%s'",
+ ck_session_get_id (session),
+ ck_session_get_seat (session) != NULL ? ck_seat_get_id (ck_session_get_seat (session)) : "(NONE)"));
+
+ d = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer");
+ if (d == NULL) {
+ d = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer");
+ }
+ if (d == NULL) {
+ goto out;
+ }
+
+ programs = hal_device_property_dup_strlist_as_strv (d, "info.callouts.session_remove");
+ if (programs == NULL) {
+ goto out;
+ }
+
+ extra_env[1] = g_strdup_printf ("HALD_SESSION_REMOVE_SESSION_ID=%s", ck_session_get_id (session));
+ extra_env[2] = g_strdup_printf ("HALD_SESSION_REMOVE_SESSION_UID=%d", ck_session_get_user (session));
+ extra_env[3] = g_strdup_printf ("HALD_SESSION_REMOVE_SESSION_IS_ACTIVE=%s",
+ ck_session_is_active (session) ? "true" : "false");
+
+ session_changes_push (d, programs, extra_env);
+
g_free (extra_env[1]);
g_free (extra_env[2]);
g_free (extra_env[3]);
--- a/tools/hal-acl-tool.c
+++ b/tools/hal-acl-tool.c
@@ -1175,7 +1175,9 @@ tryagain:
goto tryagain;
return FALSE;
}
-
+
+ printf ("\n");
+ printf ("****************************************************\n");
printf ("%d: got lock on " PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list\n", getpid ());
return TRUE;
}
@@ -1183,6 +1185,9 @@ tryagain:
static void
acl_unlock (void)
{
+ printf ("\n");
+ printf ("****************************************************\n");
+ printf ("%d: releasing lock on " PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list\n", getpid ());
#if sun
lockf (lock_acl_fd, F_ULOCK, 0);
#else
@@ -1190,7 +1195,6 @@ acl_unlock (void)
#endif
close (lock_acl_fd);
lock_acl_fd = -1;
- printf ("%d: released lock on " PACKAGE_LOCALSTATEDIR "/lib/hal/acl-list\n", getpid ());
}
int
Index: hal.spec
===================================================================
RCS file: /cvs/pkgs/rpms/hal/F-8/hal.spec,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- hal.spec 26 Feb 2008 08:29:34 -0000 1.139
+++ hal.spec 4 Mar 2008 12:00:48 -0000 1.140
@@ -26,10 +26,10 @@
Summary: Hardware Abstraction Layer
Name: hal
Version: 0.5.10
-Release: 1%{?dist}.1
+Release: 1%{?dist}.2
URL: http://www.freedesktop.org/Software/hal
Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.gz
-Patch0: hal-0.5.10-ck-acl.patch
+Patch0: hal-0.5.10-acltool-serialize.patch
License: AFL/GPL
Group: System Environment/Libraries
@@ -121,7 +121,7 @@
%prep
%setup -q
-%patch0 -p1 -b .ck-acl
+%patch0 -p1 -b .serialize-acl
%build
%configure --enable-docbook-docs --docdir=%{_datadir}/doc/%{name}-%{version} --with-os-type=redhat --enable-console-kit --enable-policy-kit --enable-acl-management --enable-umount-helper --enable-acpi-ibm --enable-acpi-toshiba --with-eject=/usr/sbin/eject
@@ -234,6 +234,9 @@
%{_datadir}/gtk-doc/html/libhal-storage/*
%changelog
+* Tue Mar 04 2008 Lubomir Kundrak <lkundrak at redhat.com> - 0.5.10-1.2
+- Replace patch added in previous revision with upstream one (#384271)
+
* Tue Feb 26 2008 Lubomir Kundrak <lkundrak at redhat.com> - 0.5.10-1.1
- Call ConsoleKit for session/seat enumeration in -acl-tool (#384271)
--- hal-0.5.10-ck-acl.patch DELETED ---
- Previous message (by thread): rpms/net-tools/devel net-tools-1.60-statistics_buffer.patch, NONE, 1.1 net-tools.spec, 1.90, 1.91
- Next message (by thread): rpms/coreutils/devel coreutils-6.10-verbose.patch, 1.1, 1.2 coreutils-colorls.csh, 1.10, 1.11 coreutils.spec, 1.196, 1.197
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list