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

David Härdeman david at hardeman.nu
Thu Apr 20 10:06:03 UTC 2017


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).

Regards,
David



More information about the systemd-devel mailing list