[dbus/f15/master] Update activation patch, add one to fix Exec comparison See https://bugzilla.gnome.org/show_bug.cgi?

Colin Walters walters at fedoraproject.org
Mon Mar 28 18:05:41 UTC 2011


commit a665b6c25f695a1cfe699227ee5154e5d449427c
Author: Colin Walters <walters at verbum.org>
Date:   Mon Mar 28 14:05:37 2011 -0400

    Update activation patch, add one to fix Exec comparison
    See https://bugzilla.gnome.org/show_bug.cgi?id=645756

 ...ivation-Strip-out-code-to-compare-by-Exec.patch |   83 ++++++++++
 ...Use-_dbus_system_log-for-activation-infor.patch |  165 ++++++++++++++++++++
 activation-logging.patch                           |  103 ------------
 dbus.spec                                          |   12 ++-
 4 files changed, 258 insertions(+), 105 deletions(-)
---
diff --git a/0001-activation-Strip-out-code-to-compare-by-Exec.patch b/0001-activation-Strip-out-code-to-compare-by-Exec.patch
new file mode 100644
index 0000000..9ecc92b
--- /dev/null
+++ b/0001-activation-Strip-out-code-to-compare-by-Exec.patch
@@ -0,0 +1,83 @@
+From a49c4490dacefc16c9cd3549623029bf3833ccce Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters at verbum.org>
+Date: Mon, 28 Mar 2011 13:21:35 -0400
+Subject: [PATCH] activation: Strip out code to compare by Exec=
+
+In commit:
+ 075945f6        (John (J5) Palmieri     2005-07-14 20:44:15 +0000
+
+some code was added to compare services by Exec key.  The changelog is
+not pariticularly informative as to why this was added. But while
+debugging other code, we noticed this.
+
+Comparing by Exec key is not in the specification, and triggered a
+problem where while converting services to use systemd for activation,
+a change was made to use Exec=/bin/false and simply rely on systemd
+to activate.
+
+While I think it was broken for the service files to be changed
+to Exec=/bin/false, we shouldn't be doing something here that's
+not in the spec either.
+---
+ bus/activation.c |   22 ++++------------------
+ 1 files changed, 4 insertions(+), 18 deletions(-)
+
+diff --git a/bus/activation.c b/bus/activation.c
+index 7b2a72b..ab6ef51 100644
+--- a/bus/activation.c
++++ b/bus/activation.c
+@@ -1685,11 +1685,9 @@ bus_activation_activate_service (BusActivation  *activation,
+   int argc;
+   dbus_bool_t retval;
+   DBusHashIter iter;
+-  dbus_bool_t activated;
++  dbus_bool_t was_pending_activation;
+   DBusString command;
+ 
+-  activated = TRUE;
+-
+   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+ 
+   if (activation->n_pending_activations >=
+@@ -1768,7 +1766,8 @@ bus_activation_activate_service (BusActivation  *activation,
+ 
+   /* Check if the service is being activated */
+   pending_activation = _dbus_hash_table_lookup_string (activation->pending_activations, service_name);
+-  if (pending_activation)
++  was_pending_activation = (pending_activation != NULL);
++  if (was_pending_activation)
+     {
+       if (!_dbus_list_append (&pending_activation->entries, pending_activation_entry))
+         {
+@@ -1875,19 +1874,6 @@ bus_activation_activate_service (BusActivation  *activation,
+       pending_activation->n_entries += 1;
+       pending_activation->activation->n_pending_activations += 1;
+ 
+-      activated = FALSE;
+-      _dbus_hash_iter_init (activation->pending_activations, &iter);
+-      while (_dbus_hash_iter_next (&iter))
+-        {
+-          BusPendingActivation *p = _dbus_hash_iter_get_value (&iter);
+-
+-          if (strcmp (p->exec, entry->exec) == 0)
+-            {
+-              activated = TRUE;
+-              break;
+-            }
+-        }
+-
+       if (!_dbus_hash_table_insert_string (activation->pending_activations,
+                                            pending_activation->service_name,
+                                            pending_activation))
+@@ -1910,7 +1896,7 @@ bus_activation_activate_service (BusActivation  *activation,
+       return FALSE;
+     }
+ 
+-  if (activated)
++  if (was_pending_activation)
+     return TRUE;
+ 
+   if (bus_context_get_systemd_activation (activation->context))
+-- 
+1.7.4.1
+
diff --git a/0001-activation-Use-_dbus_system_log-for-activation-infor.patch b/0001-activation-Use-_dbus_system_log-for-activation-infor.patch
new file mode 100644
index 0000000..0054f2a
--- /dev/null
+++ b/0001-activation-Use-_dbus_system_log-for-activation-infor.patch
@@ -0,0 +1,165 @@
+From baf1541314e11b69c7faf6a3fcd05c1006695b51 Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters at verbum.org>
+Date: Sat, 26 Mar 2011 15:52:50 -0400
+Subject: [PATCH] activation: Use _dbus_system_log for activation information
+
+Log when we are activating something (and whether it's via systemd)
+as well as when we fail to activate, and when one succeeds.
+---
+ bus/activation.c |   87 +++++++++++++++++++++++++++++++++++++++++++----------
+ 1 files changed, 70 insertions(+), 17 deletions(-)
+
+diff --git a/bus/activation.c b/bus/activation.c
+index ab6ef51..9cad01f 100644
+--- a/bus/activation.c
++++ b/bus/activation.c
+@@ -1106,6 +1106,10 @@ bus_activation_service_created (BusActivation  *activation,
+   if (!pending_activation)
+     return TRUE;
+ 
++  bus_context_log (activation->context,
++                   DBUS_SYSTEM_LOG_INFO, "Successfully activated service '%s'",
++                   service_name);
++
+   link = _dbus_list_get_first_link (&pending_activation->entries);
+   while (link != NULL)
+     {
+@@ -1400,6 +1404,11 @@ babysitter_watch_callback (DBusWatch     *watch,
+ 
+       if (activation_failed)
+         {
++          bus_context_log (pending_activation->activation->context,
++                           DBUS_SYSTEM_LOG_INFO, "Activated service '%s' failed: %s",
++                           pending_activation->service_name,
++                           error.message);
++
+           /* Destroy all pending activations with the same exec */
+           _dbus_hash_iter_init (pending_activation->activation->pending_activations,
+                                 &iter);
+@@ -1462,6 +1471,10 @@ pending_activation_timed_out (void *data)
+   dbus_set_error (&error, DBUS_ERROR_TIMED_OUT,
+                   "Activation of %s timed out",
+                   pending_activation->service_name);
++  bus_context_log (pending_activation->activation->context,
++                   DBUS_SYSTEM_LOG_INFO,
++                   "Failed to activate service '%s': timed out",
++                   pending_activation->service_name);
+ 
+   pending_activation_failed (pending_activation, &error);
+ 
+@@ -1714,6 +1727,10 @@ bus_activation_activate_service (BusActivation  *activation,
+         {
+           dbus_uint32_t result;
+ 
++          bus_context_log (activation->context,
++                           DBUS_SYSTEM_LOG_INFO, "Service '%s' is already active",
++                           service_name);
++
+           _dbus_verbose ("Service \"%s\" is already active\n", service_name);
+ 
+           message = dbus_message_new_method_return (activation_message);
+@@ -1962,18 +1979,34 @@ bus_activation_activate_service (BusActivation  *activation,
+           service = bus_registry_lookup (registry, &service_string);
+ 
+           if (service != NULL)
+-            /* Wonderful, systemd is connected, let's just send the msg */
+-            retval = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
+-                                           message, error);
++            {
++              bus_context_log (activation->context,
++                               DBUS_SYSTEM_LOG_INFO, "Activating via systemd service name='%s' unit='%s'",
++                               service_name,
++                               entry->systemd_service);
++              /* Wonderful, systemd is connected, let's just send the msg */
++              retval = bus_dispatch_matches (activation_transaction, NULL, bus_service_get_primary_owners_connection (service),
++                                             message, error);
++            }
+           else
+-            /* systemd is not around, let's "activate" it. */
+-            retval = bus_activation_activate_service (activation, connection, activation_transaction, TRUE,
+-                                                      message, "org.freedesktop.systemd1", error);
++            {
++              bus_context_log (activation->context,
++                               DBUS_SYSTEM_LOG_INFO, "Activating systemd to hand-off service name='%s' unit='%s'",
++                               service_name,
++                               entry->systemd_service);
++              /* systemd is not around, let's "activate" it. */
++              retval = bus_activation_activate_service (activation, connection, activation_transaction, TRUE,
++                                                        message, "org.freedesktop.systemd1", error);
++            }
+ 
+           dbus_message_unref (message);
+ 
+           if (!retval)
+             {
++              bus_context_log (activation->context,
++                               DBUS_SYSTEM_LOG_INFO, "Failed to activate via systemd service name='%s' unit='%s'",
++                               service_name,
++                               entry->systemd_service);
+               _DBUS_ASSERT_ERROR_IS_SET (error);
+               _dbus_verbose ("failed to send activation message: %s\n", error->name);
+               bus_transaction_cancel_and_free (activation_transaction);
+@@ -2069,18 +2102,32 @@ bus_activation_activate_service (BusActivation  *activation,
+     }
+ 
+   _dbus_verbose ("Spawning %s ...\n", argv[0]);
+-  if (!_dbus_spawn_async_with_babysitter (&pending_activation->babysitter, argv,
+-                                          envp,
+-                                          NULL, activation,
+-                                          error))
+-    {
+-      _dbus_verbose ("Failed to spawn child\n");
+-      _DBUS_ASSERT_ERROR_IS_SET (error);
+-      dbus_free_string_array (argv);
+-      dbus_free_string_array (envp);
++  bus_context_log (activation->context,
++                   DBUS_SYSTEM_LOG_INFO, "Activating service name='%s' argv0='%s'",
++                   service_name,
++                   argv[0]);
++  {
++    DBusError tmp_error;
++    dbus_error_init (&tmp_error);
++
++    if (!_dbus_spawn_async_with_babysitter (&pending_activation->babysitter, argv,
++                                            envp,
++                                            NULL, activation,
++                                            &tmp_error))
++      {
++        _dbus_verbose ("Failed to spawn child\n");
++        bus_context_log (activation->context,
++                         DBUS_SYSTEM_LOG_INFO, "Failed to activate service %s: %s",
++                         service_name,
++                         tmp_error.message);
++        _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
++        dbus_move_error (&tmp_error, error);
++        dbus_free_string_array (argv);
++        dbus_free_string_array (envp);
+ 
+-      return FALSE;
+-    }
++        return FALSE;
++      }
++  }
+ 
+   dbus_free_string_array (argv);
+   envp = NULL;
+@@ -2166,10 +2213,16 @@ dbus_activation_systemd_failure (BusActivation *activation,
+                              DBUS_TYPE_INVALID))
+     dbus_set_error(&error, code, str);
+ 
++
+   if (unit)
+     {
+       DBusHashIter iter;
+ 
++      bus_context_log (activation->context,
++                       DBUS_SYSTEM_LOG_INFO, "Activation via systemd failed for unit '%s': %s",
++                       unit,
++                       str);
++
+       _dbus_hash_iter_init (activation->pending_activations,
+                             &iter);
+ 
+-- 
+1.7.4.1
+
diff --git a/dbus.spec b/dbus.spec
index 34a3dcc..234c9b6 100644
--- a/dbus.spec
+++ b/dbus.spec
@@ -10,7 +10,7 @@ Summary: D-BUS message bus
 Name: dbus
 Epoch: 1
 Version: 1.4.6
-Release: 2%{?dist}
+Release: 3%{?dist}
 URL: http://www.freedesktop.org/software/dbus/
 #VCS: git:git://git.freedesktop.org/git/dbus/dbus
 Source0: http://dbus.freedesktop.org/releases/dbus/%{name}-%{version}.tar.gz
@@ -47,7 +47,9 @@ Patch0: bindir.patch
 Patch1: dbus-1.0.1-generate-xml-docs.patch
 
 # https://bugs.freedesktop.org/show_bug.cgi?id=35705
-Patch2: activation-logging.patch
+Patch2: 0001-activation-Use-_dbus_system_log-for-activation-infor.patch
+# https://bugs.freedesktop.org/show_bug.cgi?id=35750
+Patch3: 0001-activation-Strip-out-code-to-compare-by-Exec.patch
 
 %description
 D-BUS is a system for sending messages between applications. It is
@@ -101,6 +103,8 @@ in this separate package so server systems need not install X.
 
 %patch0 -p1 -b .bindir
 %patch1 -p1 -b .generate-xml-docs
+%patch2 -p1
+%patch3 -p1
 
 autoreconf -f -i
 
@@ -245,6 +249,10 @@ fi
 %{_includedir}/*
 
 %changelog
+* Mon Mar 28 2011 Colin Walters <walters at verbum.org> - 1:1.4.6-3
+- Update activation patch, add one to fix Exec comparison
+  See https://bugzilla.gnome.org/show_bug.cgi?id=645756
+
 * Sat Mar 26 2011 Colin Walters <walters at verbum.org> - 1:1.4.6-2
 - Add patch to log activation; we're trying to debug a potential
   bluez failure, and we really needed this before anyways.


More information about the scm-commits mailing list