[glib/glib-2-38] gdbus: Work around a D-Bus bug with path_namespace='/' match rules
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-38] gdbus: Work around a D-Bus bug with path_namespace='/' match rules
- Date: Wed, 6 Nov 2013 14:53:26 +0000 (UTC)
commit ffb9bb1f79e97f151aa8cb0352db3e81b4be9caf
Author: Philip Withnall <philip withnall collabora co uk>
Date: Wed Oct 23 15:07:46 2013 +0100
gdbus: Work around a D-Bus bug with path_namespace='/' match rules
D-Bus versions < 1.6.18 (i.e. all current versions) have a bug with the
path_namespace='/' match rule key. It should conceptually match everything,
but actually matches nothing. This results in no property change (or other)
signals being forwarded to the D-Bus client.
The work-around implemented in GDBusObjectManagerClient is to remove the
path_namespace match key if its value is ‘/’.
For the upstream D-Bus bug, see:
https://bugs.freedesktop.org/show_bug.cgi?id=70799
https://bugzilla.gnome.org/show_bug.cgi?id=710726
gio/gdbusobjectmanagerclient.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/gio/gdbusobjectmanagerclient.c b/gio/gdbusobjectmanagerclient.c
index ed0adc0..d9ccf71 100644
--- a/gio/gdbusobjectmanagerclient.c
+++ b/gio/gdbusobjectmanagerclient.c
@@ -1105,12 +1105,24 @@ subscribe_signals (GDBusObjectManagerClient *manager,
if (name_owner != NULL)
{
- /* the bus daemon may not implement path_prefix so gracefully
- * handle this by using a fallback
- */
- manager->priv->match_rule = g_strdup_printf ("type='signal',sender='%s',path_namespace='%s'",
- name_owner, manager->priv->object_path);
+ /* Only add path_namespace if it's non-'/'. This removes a no-op key from
+ * the match rule, and also works around a D-Bus bug where
+ * path_namespace='/' matches nothing in D-Bus versions < 1.6.18.
+ *
+ * See: https://bugs.freedesktop.org/show_bug.cgi?id=70799 */
+ if (g_str_equal (manager->priv->object_path, "/"))
+ {
+ manager->priv->match_rule = g_strdup_printf ("type='signal',sender='%s'",
+ name_owner);
+ }
+ else
+ {
+ manager->priv->match_rule = g_strdup_printf ("type='signal',sender='%s',path_namespace='%s'",
+ name_owner, manager->priv->object_path);
+ }
+ /* The bus daemon may not implement path_namespace so gracefully
+ * handle this by using a fallback triggered if @error is set. */
ret = g_dbus_connection_call_sync (manager->priv->connection,
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]