rpms/dbus/F-12 fix-daemon-activation.patch, NONE, 1.1 fix-reload-leak.patch, NONE, 1.1 fix-reload-race.patch, NONE, 1.1 keep-pending-activations.patch, NONE, 1.1 dbus.spec, 1.179, 1.180

Ray Strode rstrode at fedoraproject.org
Fri Dec 18 15:16:44 UTC 2009


Author: rstrode

Update of /cvs/pkgs/rpms/dbus/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13738

Modified Files:
	dbus.spec 
Added Files:
	fix-daemon-activation.patch fix-reload-leak.patch 
	fix-reload-race.patch keep-pending-activations.patch 
Log Message:
- Fix activation of daemons (#545267)
- Fix reload memleak (fdo #24697)
- Don't forget about pending activations on reload (fdo #24350)
- Fix reload race (fdo #21597)


fix-daemon-activation.patch:
 bus/activation.c                                                                          |   83 ++++++----
 configure.in                                                                              |    1 
 test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in |    3 
 test/name-test/Makefile.am                                                                |    2 
 test/name-test/run-test.sh                                                                |    6 
 test/name-test/test-activation-forking.py                                                 |   60 +++++++
 test/test-service.c                                                                       |   33 +++
 7 files changed, 155 insertions(+), 33 deletions(-)

--- NEW FILE fix-daemon-activation.patch ---
>From 949a64b127a32a3e5a4ce4278773f18e290c44c2 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters at verbum.org>
Date: Mon, 14 Dec 2009 23:12:24 +0000
Subject: Ignore exit code zero from activated services

A variety of system components have migrated from legacy init into DBus
service activation.  Many of these system components "daemonize", which
involves forking.  The DBus activation system treated an exit as an
activation failure, assuming that the child process which grabbed the
DBus name didn't run first.

While we're in here, also differentiate in this code path between the
servicehelper (system) versus direct activation (session) paths.  In
the session activation path our error message mentioned a helper
process which was confusing, since none was involved.

Based on a patch and debugging research from Ray Strode <rstrode at redhat.com>
---
diff --git a/bus/activation.c b/bus/activation.c
index 782ffed..00caac2 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -1212,8 +1212,8 @@ pending_activation_failed (BusPendingActivation *pending_activation,
  * Depending on the exit code of the helper, set the error accordingly
  */
 static void
-handle_activation_exit_error (int        exit_code,
-                              DBusError *error)
+handle_servicehelper_exit_error (int        exit_code,
+                                 DBusError *error)
 {
   switch (exit_code)
     {
@@ -1268,13 +1268,24 @@ babysitter_watch_callback (DBusWatch     *watch,
   BusPendingActivation *pending_activation = data;
   dbus_bool_t retval;
   DBusBabysitter *babysitter;
+  dbus_bool_t uses_servicehelper;
 
   babysitter = pending_activation->babysitter;
-  
+
   _dbus_babysitter_ref (babysitter);
-  
+
   retval = dbus_watch_handle (watch, condition);
 
+  /* There are two major cases here; are we the system bus or the session?  Here this
+   * is distinguished by whether or not we use a setuid helper launcher.  With the launch helper,
+   * some process exit codes are meaningful, processed by handle_servicehelper_exit_error.
+   *
+   * In both cases though, just ignore when a process exits with status 0; it's possible for
+   * a program to (misguidedly) "daemonize", and that appears to us as an exit.  This closes a race
+   * condition between this code and the child process claiming the bus name.
+   */
+  uses_servicehelper = bus_context_get_servicehelper (pending_activation->activation->context) != NULL;
+
   /* FIXME this is broken in the same way that
    * connection watches used to be; there should be
    * a separate callback for status change, instead
@@ -1284,43 +1295,59 @@ babysitter_watch_callback (DBusWatch     *watch,
    * Fixing this lets us move dbus_watch_handle
    * calls into dbus-mainloop.c
    */
-  
   if (_dbus_babysitter_get_child_exited (babysitter))
     {
       DBusError error;
       DBusHashIter iter;
-      
+      dbus_bool_t activation_failed;
+      int exit_code = 0;
+
       dbus_error_init (&error);
+
       _dbus_babysitter_set_child_exit_error (babysitter, &error);
 
-      /* refine the error code if we got an exit code */
-      if (dbus_error_has_name (&error, DBUS_ERROR_SPAWN_CHILD_EXITED))
-      	{
-          int exit_code = 0;
-          if (_dbus_babysitter_get_child_exit_status (babysitter, &exit_code))
+      /* Explicitly check for SPAWN_CHILD_EXITED to avoid overwriting an
+       * exec error */
+      if (dbus_error_has_name (&error, DBUS_ERROR_SPAWN_CHILD_EXITED)
+          && _dbus_babysitter_get_child_exit_status (babysitter, &exit_code))
+        {
+          activation_failed = exit_code != 0;
+
+          dbus_error_free(&error);
+
+          if (activation_failed)
             {
-              dbus_error_free (&error);
-              handle_activation_exit_error (exit_code, &error);
+              if (uses_servicehelper)
+                handle_servicehelper_exit_error (exit_code, &error);
+              else
+                _dbus_babysitter_set_child_exit_error (babysitter, &error);
             }
-      	}
-
-      /* Destroy all pending activations with the same exec */
-      _dbus_hash_iter_init (pending_activation->activation->pending_activations,
-                            &iter);
-      while (_dbus_hash_iter_next (&iter))
+        }
+      else
         {
-          BusPendingActivation *p = _dbus_hash_iter_get_value (&iter);
-         
-          if (p != pending_activation && strcmp (p->exec, pending_activation->exec) == 0)
-            pending_activation_failed (p, &error);
+          activation_failed = TRUE;
         }
-      
-      /* Destroys the pending activation */
-      pending_activation_failed (pending_activation, &error);
 
-      dbus_error_free (&error);
+      if (activation_failed)
+        {
+          /* Destroy all pending activations with the same exec */
+          _dbus_hash_iter_init (pending_activation->activation->pending_activations,
+                                &iter);
+          while (_dbus_hash_iter_next (&iter))
+            {
+              BusPendingActivation *p = _dbus_hash_iter_get_value (&iter);
+
+              if (p != pending_activation && strcmp (p->exec, pending_activation->exec) == 0)
+                pending_activation_failed (p, &error);
+            }
+
+          /* Destroys the pending activation */
+          pending_activation_failed (pending_activation, &error);
+
+          dbus_error_free (&error);
+        }
     }
-  
+
   _dbus_babysitter_unref (babysitter);
 
   return retval;
diff --git a/configure.in b/configure.in
index 7ef6632..1f2c896 100644
--- a/configure.in
+++ b/configure.in
@@ -1499,6 +1499,7 @@ test/data/valid-config-files-system/debug-allow-all-pass.conf
 test/data/valid-config-files-system/debug-allow-all-fail.conf
 test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service
 test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service
+test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service
 test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service
 test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service
 test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service
diff --git a/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in
new file mode 100644
index 0000000..49fcac3
--- a/dev/null
+++ b/test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.freedesktop.DBus.TestSuiteForkingEchoService
+Exec=@TEST_SERVICE_BINARY@ org.freedesktop.DBus.TestSuiteForkingEchoService fork
diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am
index 1c73b87..d8e72d1 100644
--- a/test/name-test/Makefile.am
+++ b/test/name-test/Makefile.am
@@ -10,7 +10,7 @@ else
 TESTS=
 endif
 
-EXTRA_DIST=run-test.sh run-test-systemserver.sh test-wait-for-echo.py
+EXTRA_DIST=run-test.sh run-test-systemserver.sh test-wait-for-echo.py test-activation-forking.py
 
 if DBUS_BUILD_TESTS
 
diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh
index fba4558..4eb2425 100755
--- a/test/name-test/run-test.sh
+++ b/test/name-test/run-test.sh
@@ -50,3 +50,9 @@ ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-
 
 echo "running test-shutdown"
 ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-shutdown || die "test-shutdown failed"
+
+echo "running test activation forking"
+if ! python $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then
+  echo "Failed test-activation-forking"
+  exit 1
+fi
diff --git a/test/name-test/test-activation-forking.py b/test/name-test/test-activation-forking.py
new file mode 100644
index 0000000..0d82075
--- a/dev/null
+++ b/test/name-test/test-activation-forking.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+import os,sys
+
+try:
+    import gobject
+    import dbus
+    import dbus.mainloop.glib
+except:
+    print "Failed import, aborting test"
+    sys.exit(0)
+
+dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+loop = gobject.MainLoop()
+
+exitcode = 0
+
+bus = dbus.SessionBus()
+bus_iface = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus')
+
+o = bus.get_object('org.freedesktop.DBus.TestSuiteForkingEchoService', '/org/freedesktop/TestSuite')
+i = dbus.Interface(o, 'org.freedesktop.TestSuite')
+
+# Start it up
+reply = i.Echo("hello world")
+print "TestSuiteForkingEchoService initial reply OK"
+
+def ignore(*args, **kwargs):
+    pass
+
+# Now monitor for exits, when that happens, start it up again.
+# The goal here is to try to hit any race conditions in activation.
+counter = 0
+def on_forking_echo_owner_changed(name, old, new):
+    global counter
+    global o
+    global i
+    if counter > 10:
+        print "Activated 10 times OK, TestSuiteForkingEchoService pass"
+        loop.quit()
+        return
+    counter += 1
+    if new == '':
+        o = bus.get_object('org.freedesktop.DBus.TestSuiteForkingEchoService', '/org/freedesktop/TestSuite')
+        i = dbus.Interface(o, 'org.freedesktop.TestSuite')
+        i.Echo("counter %r" % counter)
+        i.Exit(reply_handler=ignore, error_handler=ignore)
+
+bus_iface.connect_to_signal('NameOwnerChanged', on_forking_echo_owner_changed, arg0='org.freedesktop.DBus.TestSuiteForkingEchoService')
+
+i.Exit(reply_handler=ignore, error_handler=ignore)
+
+def check_counter():
+    if counter == 0:
+        print "Failed to get NameOwnerChanged for TestSuiteForkingEchoService"
+        sys.exit(1)
+gobject.timeout_add(15000, check_counter)
+
+loop.run()
+sys.exit(0)
diff --git a/test/test-service.c b/test/test-service.c
index c9f5839..a57bf9c 100644
--- a/test/test-service.c
+++ b/test/test-service.c
@@ -398,7 +398,33 @@ main (int    argc,
   DBusError error;
   int result;
   DBusConnection *connection;
-  
+  const char *name;
+  dbus_bool_t do_fork;
+
+  if (argc != 3)
+    {
+      name = "org.freedesktop.DBus.TestSuiteEchoService";
+      do_fork = FALSE;
+    }
+  else
+    {
+      name = argv[1];
+      do_fork = strcmp (argv[2], "fork") == 0;
+    }
+
+  /* The bare minimum for simulating a program "daemonizing"; the intent
+   * is to test services which move from being legacy init scripts to
+   * activated services.
+   * https://bugzilla.redhat.com/show_bug.cgi?id=545267
+   */
+  if (do_fork)
+    {
+      pid_t pid = fork ();
+      if (pid != 0)
+        exit (0);
+      sleep (1);
+    }
+
   dbus_error_init (&error);
   connection = dbus_bus_get (DBUS_BUS_STARTER, &error);
   if (connection == NULL)
@@ -433,8 +459,8 @@ main (int    argc,
     if (d != (void*) 0xdeadbeef)
       die ("dbus_connection_get_object_path_data() doesn't seem to work right\n");
   }
-  
-  result = dbus_bus_request_name (connection, "org.freedesktop.DBus.TestSuiteEchoService",
+
+  result = dbus_bus_request_name (connection, name,
                                   0, &error);
   if (dbus_error_is_set (&error))
     {
--
cgit v0.8.3-6-g21f6

fix-reload-leak.patch:
 bus.c |    2 ++
 1 file changed, 2 insertions(+)

--- NEW FILE fix-reload-leak.patch ---
diff -up dbus-1.2.16/bus/bus.c.policy-leak dbus-1.2.16/bus/bus.c
--- dbus-1.2.16/bus/bus.c.policy-leak   2009-12-17 19:18:50.966795963 -0500
+++ dbus-1.2.16/bus/bus.c       2009-12-17 19:17:36.023796405 -0500
@@ -438,6 +438,8 @@ process_config_every_time (BusContext   
   /* get our limits and timeout lengths */
   bus_config_parser_get_limits (parser, &context->limits);

+  if (context->policy)
+    bus_policy_unref (context->policy);
   context->policy = bus_config_parser_steal_policy (parser);
   _dbus_assert (context->policy != NULL);


fix-reload-race.patch:
 bus.c               |    9 ---
 dir-watch-inotify.c |  134 ++++++++++++++++++++++++++++++++++++++++++++--------
 dir-watch.h         |    2 
 3 files changed, 117 insertions(+), 28 deletions(-)

--- NEW FILE fix-reload-race.patch ---
--- dbus-1.2.16/bus/dir-watch-inotify.c	2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/dir-watch-inotify.c	2009-12-18 00:46:05.524818800 -0500
@@ -34,6 +34,7 @@
 #include <errno.h>
 
 #include <dbus/dbus-internals.h>
+#include <dbus/dbus-list.h>
 #include <dbus/dbus-watch.h>
 #include "dir-watch.h"
 
@@ -43,6 +44,7 @@
 
 /* use a static array to avoid handling OOM */
 static int wds[MAX_DIRS_TO_WATCH];
+static char *dirs[MAX_DIRS_TO_WATCH];
 static int num_wds = 0;
 static int inotify_fd = -1;
 static DBusWatch *watch = NULL;
@@ -90,12 +92,10 @@
   return TRUE;
 }
 
-void
-bus_watch_directory (const char *dir, BusContext *context)
+static int
+_init_inotify (BusContext *context)
 {
-  int wd;
-
-  _dbus_assert (dir != NULL);
+  int ret = 0;
 
   if (inotify_fd == -1) {
 #ifdef HAVE_INOTIFY_INIT1
@@ -112,22 +112,38 @@
      watch = _dbus_watch_new (inotify_fd, DBUS_WATCH_READABLE, TRUE,
                               _handle_inotify_watch, NULL, NULL);
 
-	if (watch == NULL)
-          {
-            _dbus_warn ("Unable to create inotify watch\n");
-	    goto out;
-	  }
-
-	if (!_dbus_loop_add_watch (loop, watch, _inotify_watch_callback,
-                                   NULL, NULL))
-          {
-            _dbus_warn ("Unable to add reload watch to main loop");
-	    _dbus_watch_unref (watch);
-	    watch = NULL;
-            goto out;
-	  }
+     if (watch == NULL)
+       {
+         _dbus_warn ("Unable to create inotify watch\n");
+         goto out;
+       }
+
+     if (!_dbus_loop_add_watch (loop, watch, _inotify_watch_callback,
+                                NULL, NULL))
+       {
+         _dbus_warn ("Unable to add reload watch to main loop");
+	 _dbus_watch_unref (watch);
+	 watch = NULL;
+         goto out;
+       }
   }
 
+  ret = 1;
+
+out:
+  return ret;
+}
+
+void
+bus_watch_directory (const char *dir, BusContext *context)
+{
+  int wd;
+
+  _dbus_assert (dir != NULL);
+
+  if (!_init_inotify (context))
+    goto out;
+
   if (num_wds >= MAX_DIRS_TO_WATCH )
     {
       _dbus_warn ("Cannot watch config directory '%s'. Already watching %d directories\n", dir, MAX_DIRS_TO_WATCH);
@@ -141,6 +157,7 @@
       goto out;
     }
 
+  dirs[num_wds] = strdup (dir);
   wds[num_wds++] = wd;
   _dbus_verbose ("Added watch on config directory '%s'\n", dir);
 
@@ -148,7 +165,84 @@
   ;
 }
 
-void 
+void
+bus_set_watched_dirs (BusContext *context, DBusList **directories)
+{
+  static int new_wds[MAX_DIRS_TO_WATCH];
+  static char *new_dirs[MAX_DIRS_TO_WATCH];
+  DBusList *link;
+  int i, j, wd;
+
+  if (!_init_inotify (context))
+    goto out;
+
+  for (i = 0; i < MAX_DIRS_TO_WATCH; i++)
+    {
+      new_wds[i] = -1;
+      new_dirs[i] = NULL;
+    }
+
+  i = 0;
+  link = _dbus_list_get_first_link (directories);
+  while (link != NULL)
+    {
+      new_dirs[i++] = (char *)link->data;
+      link = _dbus_list_get_next_link (directories, link);
+    }
+
+  for (i = 0; new_dirs[i]; i++)
+    {
+      for (j = 0; j < num_wds; j++)
+        {
+          if (dirs[j] && strcmp (new_dirs[i], dirs[j]) == 0)
+            {
+              new_wds[i] = wds[j];
+              new_dirs[i] = dirs[j];
+              wds[j] = -1;
+              dirs[j] = NULL;
+              break;
+            }
+        }
+    }
+
+  for (j = 0; j < num_wds; j++)
+    {
+      if (wds[j] != -1)
+        {
+          inotify_rm_watch (inotify_fd, wds[j]);
+          dbus_free (dirs[j]);
+          wds[j] = -1;
+          dirs[j] = NULL;
+        }
+    }
+
+  for (i = 0; new_dirs[i]; i++)
+    {
+      if (new_wds[i] == -1)
+        {
+          wd = inotify_add_watch (inotify_fd, new_dirs[i], IN_CLOSE_WRITE | IN_DELETE | IN_MOVED_TO | IN_MOVED_FROM);
+          if (wd < 0)
+            {
+              _dbus_warn ("Cannot setup inotify for '%s'; error '%s'\n", new_dirs[i], _dbus_strerror (errno));
+              goto out;
+            }
+          new_wds[i] = wd;
+          new_dirs[i] = strdup (new_dirs[i]);
+        }
+    }
+
+  num_wds = i;
+
+  for (i = 0; i < MAX_DIRS_TO_WATCH; i++)
+    {
+      wds[i] = new_wds[i];
+      dirs[i] = new_dirs[i];
+    }
+
+ out:;
+}
+
+void
 bus_drop_all_directory_watches (void)
 {
   int ret;
--- dbus-1.2.16/bus/dir-watch.h	2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/dir-watch.h	2009-12-18 00:45:47.437818936 -0500
@@ -32,4 +32,6 @@
 /* drop all the watches previously set up by bus_config_watch_directory (OS dependent, may be a NOP) */
 void bus_drop_all_directory_watches (void);
 
+void bus_set_watched_dirs (BusContext *context, DBusList **dirs);
+
 #endif /* DIR_WATCH_H */
--- dbus-1.2.16/bus/bus.c	2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/bus.c	2009-12-18 00:51:30.348481884 -0500
@@ -516,11 +516,6 @@
 
   context->activation = new_activation;
 
-  /* Drop existing conf-dir watches (if applicable) */
-
-  if (is_reload)
-    bus_drop_all_directory_watches ();
-
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   retval = TRUE;
 
@@ -551,9 +546,7 @@
   _dbus_hash_table_unref (service_context_table);
 
   /* Watch all conf directories */
-  _dbus_list_foreach (bus_config_parser_get_conf_dirs (parser),
-		      (DBusForeachFunction) bus_watch_directory,
-		      context);
+  bus_set_watched_dirs (context, bus_config_parser_get_conf_dirs (parser));
 
   return TRUE;
 }

keep-pending-activations.patch:
 activation.c |   95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 activation.h |    4 ++
 bus.c        |   14 +++-----
 3 files changed, 105 insertions(+), 8 deletions(-)

--- NEW FILE keep-pending-activations.patch ---
diff -u -r dbus-1.2.16/bus/activation.c hacked/bus/activation.c
--- dbus-1.2.16/bus/activation.c	2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/activation.c	2009-12-17 21:36:56.447546354 -0500
@@ -736,6 +736,101 @@
 }
 
 BusActivation*
+bus_activation_reload (BusActivation     *activation,
+                       const DBusString  *address,
+                       DBusList         **directories,
+                       DBusError         *error)
+{
+  DBusList      *link;
+  char          *dir;
+
+  dbus_free (activation->server_address);
+  if (!_dbus_string_copy_data (address, &activation->server_address))
+    {
+      BUS_SET_OOM (error);
+      goto failed;
+    }
+
+  _dbus_hash_table_unref (activation->entries);
+  activation->entries = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
+                                             (DBusFreeFunction)bus_activation_entry_unref);
+  if (activation->entries == NULL)
+    {
+      BUS_SET_OOM (error);
+      goto failed;
+    }
+
+  _dbus_hash_table_unref (activation->directories);
+  activation->directories = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
+                                                  (DBusFreeFunction)bus_service_directory_unref);
+
+  if (activation->directories == NULL)
+    {
+      BUS_SET_OOM (error);
+      goto failed;
+    }
+
+  link = _dbus_list_get_first_link (directories);
+  while (link != NULL)
+    {
+      BusServiceDirectory *s_dir;
+
+      dir = _dbus_strdup ((const char *) link->data);
+      if (!dir)
+        {
+          BUS_SET_OOM (error);
+          goto failed;
+        }
+
+      s_dir = dbus_new0 (BusServiceDirectory, 1);
+      if (!s_dir)
+        {
+          dbus_free (dir);
+          BUS_SET_OOM (error);
+          goto failed;
+        }
+
+      s_dir->refcount = 1;
+      s_dir->dir_c = dir;
+
+      s_dir->entries = _dbus_hash_table_new (DBUS_HASH_STRING, NULL,
+                                             (DBusFreeFunction)bus_activation_entry_unref);
+
+      if (!s_dir->entries)
+        {
+          bus_service_directory_unref (s_dir);
+          BUS_SET_OOM (error);
+          goto failed;
+        }
+
+      if (!_dbus_hash_table_insert_string (activation->directories, s_dir->dir_c, s_dir))
+        {
+          bus_service_directory_unref (s_dir);
+          BUS_SET_OOM (error);
+          goto failed;
+        }
+
+      /* only fail on OOM, it is ok if we can't read the directory */
+      if (!update_directory (activation, s_dir, error))
+        {
+          if (dbus_error_has_name (error, DBUS_ERROR_NO_MEMORY))
+            goto failed;
+          else
+            dbus_error_free (error);
+        }
+
+      link = _dbus_list_get_next_link (directories, link);
+    }
+
+  return activation;
+
+ failed:
+  if (activation)
+    bus_activation_unref (activation);
+  return NULL;
+}
+
+BusActivation*
 bus_activation_new (BusContext        *context,
                     const DBusString  *address,
                     DBusList         **directories,
diff -u -r dbus-1.2.16/bus/activation.h hacked/bus/activation.h
--- dbus-1.2.16/bus/activation.h	2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/activation.h	2009-12-17 20:02:53.347545761 -0500
@@ -32,6 +32,10 @@
 						const DBusString  *address,
 						DBusList         **directories,
 						DBusError         *error);
+BusActivation* bus_activation_reload           (BusActivation     *activation,
+						const DBusString  *address,
+						DBusList         **directories,
+						DBusError         *error);
 BusActivation* bus_activation_ref              (BusActivation     *activation);
 void           bus_activation_unref            (BusActivation     *activation);
 
diff -u -r dbus-1.2.16/bus/bus.c hacked/bus/bus.c
--- dbus-1.2.16/bus/bus.c	2009-07-14 13:06:31.000000000 -0400
+++ hacked/bus/bus.c	2009-12-17 20:04:08.006546566 -0500
@@ -503,19 +503,17 @@
     }
   
   /* Create activation subsystem */
-  new_activation = bus_activation_new (context, &full_address,
-                                       dirs, error);
-  if (new_activation == NULL)
+  if (context->activation)
+    bus_activation_reload (context->activation, &full_address, dirs, error);
+  else
+    context->activation = bus_activation_new (context, &full_address, dirs, error);
+
+  if (context->activation == NULL)
     {
       _DBUS_ASSERT_ERROR_IS_SET (error);
       goto failed;
     }
 
-  if (is_reload)
-    bus_activation_unref (context->activation);
-
-  context->activation = new_activation;
-
   /* Drop existing conf-dir watches (if applicable) */
 


Index: dbus.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dbus/F-12/dbus.spec,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -p -r1.179 -r1.180
--- dbus.spec	7 Oct 2009 22:59:33 -0000	1.179
+++ dbus.spec	18 Dec 2009 15:16:44 -0000	1.180
@@ -9,7 +9,7 @@ Summary: D-BUS message bus
 Name: dbus
 Epoch: 1
 Version: 1.2.16
-Release: 8%{?dist}
+Release: 9%{?dist}
 URL: http://www.freedesktop.org/software/dbus/
 Source0: http://dbus.freedesktop.org/releases/dbus/%{name}-%{version}.tar.gz
 Source1: doxygen_to_devhelp.xsl
@@ -49,6 +49,20 @@ Patch2: fix-timeout-accounting.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=518541
 Patch3: dbus-1.2.16-capability.patch
 
+# https://bugzilla.redhat.com/show_bug.cgi?id=545267
+# http://bugs.freedesktop.org/25642
+Patch4: fix-reload-leak.patch
+
+# http://bugs.freedesktop.org/25697
+Patch5: fix-daemon-activation.patch
+
+# http://bugs.freedesktop.org/24350
+Patch6: keep-pending-activations.patch
+
+# http://bugs.freedesktop.org/21597
+Patch7: fix-reload-race.patch
+
+
 %description
 D-BUS is a system for sending messages between applications. It is
 used both for the system-wide message bus service, and as a
@@ -104,6 +118,10 @@ in this separate package so server syste
 %patch1 -p1 -b .generate-xml-docs
 %patch2 -p1 -b .fix-timeout-accounting
 %patch3 -p1 -b .capability
+%patch4 -p1 -b .fix-reload-leak
+%patch5 -p1 -b .fix-daemon-activation
+%patch6 -p1 -b .keep-pending-activations
+%patch7 -p1 -b .fix-reload-race
 
 autoreconf -f -i
 
@@ -240,6 +258,12 @@ fi
 %{_includedir}/*
 
 %changelog
+* Fri Dec 18 2009 Ray Strode <rstrode at redhat.com> - 1:1.2.16-9
+- Fix activation of daemons (#545267)
+- Fix reload memleak (fdo #24697)
+- Don't forget about pending activations on reload (fdo #24350)
+- Fix reload race (fdo #21597)
+
 * Wed Oct  7 2009 Matthias Clasen <mclasen at redhat.com> - 1:1.2.16-8
 - Drop capabilities (#518541)
 




More information about the fedora-extras-commits mailing list