Bug 70799

Summary: Match rules with path_namespace='/' don't match anything
Product: dbus Reporter: Philip Withnall <bugzilla>
Component: coreAssignee: Simon McVittie <smcv>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: [1.6, master] path_namespace='/' should match everything

Description Philip Withnall 2013-10-23 14:07:19 UTC
Adding a match rule such as the following:

string "type='signal',sender=':1.94',path_namespace='/'"

results in zero signals being forwarded to that D-Bus client. It appears that the special case of path_namespace='/' matches nothing, instead of everything (because conceptually it should be a no-op match key).

This kind of match rule can occur with GDBusObjectManagerClient if the ObjectManager is at path ā€˜/ā€™.
Comment 1 Philip Withnall 2013-10-23 14:14:16 UTC
Downstream workaround in GIO: https://bugzilla.gnome.org/show_bug.cgi?id=710726
Comment 2 Simon McVittie 2013-10-23 14:16:28 UTC
App-level workaround: compose and add your own match rule without the path_namespace.

Nobody spotted this before because an ObjectManager at '/' is usually an undesirable thing to do: you'll get every signal emitted by the entire service.
Comment 3 Simon McVittie 2013-10-23 14:19:58 UTC
Created attachment 88037 [details] [review]
[1.6, master] path_namespace='/' should match everything
Comment 4 Philip Withnall 2013-10-23 14:50:10 UTC
Comment on attachment 88037 [details] [review]
[1.6, master] path_namespace='/' should match everything

Review of attachment 88037 [details] [review]:
-----------------------------------------------------------------

Iā€™m not a D-Bus reviewer, but this looks good to me.
Comment 5 Allison Lortie (desrt) 2013-10-23 16:05:38 UTC
Comment on attachment 88037 [details] [review]
[1.6, master] path_namespace='/' should match everything

Review of attachment 88037 [details] [review]:
-----------------------------------------------------------------

::: bus/signals.c
@@ +1842,2 @@
>         */
> +      if (len > 1 && path[len] != '\0' && path[len] != '/')

I'd have put the len > 1 case before the prefix match but this will obviously work and the docs are clear enough.
Comment 6 Simon McVittie 2013-10-23 16:16:49 UTC
Thanks, fixed in git for 1.6.18 and 1.7.8.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.