rpms/dbus-glib/devel 0001-Bug-19441-Don-t-send-reply-when-none-is-requested.patch, NONE, 1.1 dbus-glib.spec, 1.34, 1.35

Colin Walters walters at fedoraproject.org
Wed Jan 7 20:44:16 UTC 2009


Author: walters

Update of /cvs/pkgs/rpms/dbus-glib/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10768

Modified Files:
	dbus-glib.spec 
Added Files:
	0001-Bug-19441-Don-t-send-reply-when-none-is-requested.patch 
Log Message:
* Wed Jan 07 2009 Colin Walters <walters at verbum.org> - 0.78-2
- Add patch to avoid sending reply to noreply messages; this avoids
  some spurious dbus denial logs during system startup from NM


0001-Bug-19441-Don-t-send-reply-when-none-is-requested.patch:

--- NEW FILE 0001-Bug-19441-Don-t-send-reply-when-none-is-requested.patch ---
>From a9eaac78c30a9a2728384b88eb6667504b758e24 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters at verbum.org>
Date: Wed, 7 Jan 2009 10:02:12 -0500
Subject: [PATCH] Bug 19441 - Don't send reply when none is requested

It's normally harmless, but unrequested replies now get noisly
denied by the system bus.
---
 dbus/dbus-gobject.c |   42 ++++++++++++++++++++++++------------------
 1 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c
index 572fafd..107dd10 100644
--- a/dbus/dbus-gobject.c
+++ b/dbus/dbus-gobject.c
@@ -1117,7 +1117,7 @@ invoke_object_method (GObject         *object,
 		      DBusConnection  *connection,
 		      DBusMessage     *message)
 {
-  gboolean had_error, call_only;
+  gboolean had_error, use_thread, send_reply;
   GError *gerror;
   GValueArray *value_array;
   GValue return_value = {0,};
@@ -1128,7 +1128,7 @@ invoke_object_method (GObject         *object,
   int out_param_count;
   int out_param_pos, out_param_gvalue_pos;
   DBusHandlerResult result;
-  DBusMessage *reply;
+  DBusMessage *reply = NULL;
   gboolean have_retval;
   gboolean retval_signals_error;
   gboolean retval_is_synthetic;
@@ -1140,10 +1140,8 @@ invoke_object_method (GObject         *object,
   /* Determine whether or not this method should be invoked in a new
      thread
    */
-  if (strcmp (string_table_lookup (get_method_data (object_info, method), 2), "A") == 0)
-    call_only = TRUE;
-  else
-    call_only = FALSE;
+  use_thread = strcmp (string_table_lookup (get_method_data (object_info, method), 2), "A") == 0;
+  send_reply = !dbus_message_get_no_reply (message); 
 
   have_retval = FALSE;
   retval_signals_error = FALSE;
@@ -1194,7 +1192,7 @@ invoke_object_method (GObject         *object,
   g_value_init (g_value_array_get_nth (value_array, 0), G_TYPE_OBJECT);
   g_value_set_object (g_value_array_get_nth (value_array, 0), object);
   
-  if (call_only)
+  if (use_thread)
     {
       GValue context_value = {0,};
       DBusGMethodInvocation *context;
@@ -1340,7 +1338,7 @@ invoke_object_method (GObject         *object,
 		      value_array->n_values,
 		      value_array->values,
 		      NULL, method->function);
-  if (call_only)
+  if (use_thread)
     {
       result = DBUS_HANDLER_RESULT_HANDLED;
       goto done;
@@ -1354,17 +1352,25 @@ invoke_object_method (GObject         *object,
     {
       DBusMessageIter iter;
 
-      reply = dbus_message_new_method_return (message);
-      if (reply == NULL)
-	goto nomem;
+      /* Careful here - there are two major cases in this section of the code.
+       * If send_reply is TRUE, we're constructing a dbus message and freeing
+       * the return values.  If it's FALSE, then we just need to free the
+       * values.
+       */
+      if (send_reply)
+        {
+          reply = dbus_message_new_method_return (message);
+          if (reply == NULL)
+            goto nomem;
 
-      /* Append output arguments to reply */
-      dbus_message_iter_init_append (reply, &iter);
+          /* Append output arguments to reply */
+          dbus_message_iter_init_append (reply, &iter);
+        }
 
       /* First, append the return value, unless it's synthetic */
       if (have_retval && !retval_is_synthetic)
-	{
-	  if (!_dbus_gvalue_marshal (&iter, &return_value))
+	{ 
+	  if (send_reply && !_dbus_gvalue_marshal (&iter, &return_value))
 	    goto nomem;
 	  if (!retval_is_constant)
 	    g_value_unset (&return_value);
@@ -1416,7 +1422,7 @@ invoke_object_method (GObject         *object,
 	      out_param_gvalue_pos++;
 	    }
 	      
-	  if (!_dbus_gvalue_marshal (&iter, &gvalue))
+	  if (send_reply && !_dbus_gvalue_marshal (&iter, &gvalue))
 	    goto nomem;
 	  /* Here we actually free the allocated value; we
 	   * took ownership of it with _dbus_gvalue_take, unless
@@ -1426,7 +1432,7 @@ invoke_object_method (GObject         *object,
 	    g_value_unset (&gvalue);
 	}
     }
-  else
+  else if (send_reply)
     reply = gerror_to_dbus_error_message (object_info, message, gerror);
 
   if (reply)
@@ -1438,7 +1444,7 @@ invoke_object_method (GObject         *object,
   result = DBUS_HANDLER_RESULT_HANDLED;
  done:
   g_free (in_signature);
-  if (!call_only)
+  if (!use_thread)
     {
       g_array_free (out_param_values, TRUE);
       g_value_array_free (out_param_gvalues);
-- 
1.6.0.6



Index: dbus-glib.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dbus-glib/devel/dbus-glib.spec,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- dbus-glib.spec	4 Dec 2008 21:26:22 -0000	1.34
+++ dbus-glib.spec	7 Jan 2009 20:43:45 -0000	1.35
@@ -8,7 +8,7 @@
 Summary: GLib bindings for D-Bus
 Name: dbus-glib
 Version: 0.78
-Release: 1%{?dist}
+Release: 2%{?dist}
 URL: http://www.freedesktop.org/software/dbus/
 Source0: http://dbus.freedesktop.org/releases/dbus-glib/%{name}-%{version}.tar.gz
 Source1: dbus-bus-introspect.xml
@@ -27,6 +27,9 @@
 # this patch requires autoreconf
 BuildRequires: autoconf automake libtool gettext-devel gtk-doc
 
+#http://bugs.freedesktop.org/show_bug.cgi?id=19441
+Patch0: 0001-Bug-19441-Don-t-send-reply-when-none-is-requested.patch
+
 %description
 
 D-Bus add-on library to integrate the standard D-Bus library with
@@ -59,6 +62,7 @@
 
 %prep
 %setup -q
+%patch0 -p1 -b .noreply
 
 %build
 libtoolize --force --copy
@@ -119,6 +123,10 @@
 %endif
 
 %changelog
+* Wed Jan 07 2009 Colin Walters <walters at verbum.org> - 0.78-2
+- Add patch to avoid sending reply to noreply messages; this avoids
+  some spurious dbus denial logs during system startup from NM
+
 * Thu Dec 04 2008 Colin Walters <walters at verbum.org> - 0.78-1
 - New upstream release, drop upstreamed patches
 




More information about the fedora-extras-commits mailing list