[systemd-devel] sd-bus: ObjectManager difference with gdbus

David Herrmann dh.herrmann at gmail.com
Fri Apr 21 11:22:15 UTC 2017


Hi

On Fri, Apr 21, 2017 at 11:50 AM, David Härdeman <david at hardeman.nu> wrote:
> On Thu, Apr 20, 2017 at 02:19:22PM +0200, David Herrmann wrote:
>>On Thu, Apr 20, 2017 at 12:06 PM, David Härdeman <david at hardeman.nu> wrote:
>>> Hi,
>>>
>>> I'm implementing a server which creates an ObjectManager using the
>>> sd-bus API and there seems to be some differences between how gdbus and
>>> sd-bus implements the API.
>>>
>>> I implemented a simple ObjectManager at /org/gnome/TestManager which
>>> exports objects /org/gnome/TestManager/fooX with interface
>>> org.gnome.TestManager.Device.
>>>
>>> Under sd-bus, if an object is removed, the following signal is
>>> generated:
>>>
>>> signal time=1492642227.714223 sender=:1.104 -> destination=(null destination)
>>>         serial=90 path=/org/gnome/TestManager;
>>>         interface=org.freedesktop.DBus.ObjectManager;
>>>         member=InterfacesRemoved
>>>    object path "/org/gnome/TestManager/foo0"
>>>    array [
>>>       string "org.freedesktop.DBus.Peer"
>>>       string "org.freedesktop.DBus.Introspectable"
>>>       string "org.freedesktop.DBus.Properties"
>>>       string "org.freedesktop.DBus.ObjectManager"
>>>       string "org.gnome.TestManager.Device"
>>>    ]
>>>
>>> If I implement the same simple server in gdbus, the signal is instead:
>>>
>>> signal time=1492642227.714223 sender=:1.104 -> destination=(null destination)
>>>         serial=90 path=/org/gnome/TestManager;
>>>         interface=org.freedesktop.DBus.ObjectManager;
>>>         member=InterfacesRemoved
>>>    object path "/org/gnome/TestManager/foo0"
>>>    array [
>>>       string "org.gnome.TestManager.Device"
>>>    ]
>>>
>>> The corresponding signals are also generated when an object is added.
>>>
>>> Beside simply being different, this difference seems to confuse gdbus.
>>> If I create a test client, it will report that any object which is
>>> already existing when I start the client has 1 interface and any object
>>> which is added/removed subsequently is reported as having 5 interfaces,
>>> 4 of which are nameless (this would appear to be one or more gdbus
>>> bug(s)).
>>>
>>> This bug in gdbus also means that it doesn't correctly catch the removal
>>> of an object which existed at the time the client was started (because
>>> of the interface count mismatch).
>>>
>>> Anyway, gdbus bugs aside, it seems that the interfaces reported by
>>> sd-bus should match what gdbus does? (assuming, of course, that gdbus
>>> can be considered the "reference" implementation).
>>
>>Does the appended patch fix your issue?
>>(line-breaks might be screwed, sorry)
>
> Haven't tried it yet, but just from reading the patch...it seems to do
> the opposite of what I'd expect? I.e. add *more* interfaces?

This change makes sure all objects have the built-in interfaces
reported at all times. The GetManagedObjects() call didn't report them
so far.

Note that we really better report all interfaces an object supports. I
don't know why glib does not do this, but I think it should.

Thanks
David


More information about the systemd-devel mailing list