No way to advertise an interface?

Thomas Kluyver thomas at kluyver.me.uk
Wed Sep 29 08:30:04 UTC 2021


I've wondered about this as well. Essentially, bus names provide a way for a program to say "I am *the* XYZ" (e.g. notifications server), but there's no well defined way to announce "I am *an* XYZ", if you want more than one XYZ to be usable at once.

The closest thing I've seen is the Implements key in desktop entry files [1], which is recommended to refer to a D-Bus interface name. For a given interface, you could scan desktop entry files to see what implements it. That's kind of outside D-Bus itself, though I don't know how much that matters.

If the concern is just about namespacing, specifications like MPRIS could say that you should use a second reverse domain name inside the namespace they're opening up, so you would get names like org.mpris.MediaPlayer2.org.videolan.vlc . I think that works, though it's kind of ugly.

Best wishes,
Thomas

[1] https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s09.html

On Wed, 29 Sep 2021, at 09:01, Anders Feder wrote:
> "the other bus" was a typo, I just meant "the bus".
> 
> ons. 29. sep. 2021 09.57 skrev Anders Feder <anders.feder.83 at gmail.com>:
>> No, that is the rub. In the example with two applications both deciding to take the bus name “org.mpris.MediaPlayer2.musicplayer”, you do in fact need both to available on the bus at the same time. Because otherwise one of them precludes the other from being controlled by clients.
>> 
>> It is currently possible to have for instance VLC and Spotify both running and both controllable via MPRIS at the same time. But this is only possible because they happen to have different names and their programmers therefore have chosen to take different bus names.
>> 
>> If they had chosen to take same bus name because they were not aware of each other, then one would either replace the other on the other bus or have to wait in queue as you say, thus preventing one of them from being controlled this way.
>> 
>> The way MPRIS is designed, the programmer must choose a bus name and can then only pray that no other media player will try to use the same name. In my view, this is not a good design. I would be interested to understand if a better design could be made or if D-Bus could be extended to support this scenario or if not why not.
>> 
>> Regards,
>> Anders Feder
>> 
>> ons. 29. sep. 2021 09.27 skrev Lawrence D'Oliveiro <ldo at geek-central.gen.nz>:
>>> On Wed, 29 Sep 2021 08:03:20 +0200, Anders Feder wrote:
>>> 
>>> > If a person A creates an application named "Music Player" and have it
>>> > take the bus name "org.mpris.MediaPlayer2.musicplayer", there is no
>>> > procedure preventing a person B without knowledge of person A's
>>> > application from creating another application named "Music Player"
>>> > also taking the bus name "org.mpris.MediaPlayer2.musicplayer".
>>> 
>>> It is true that D-Bus has no concept of “group” or “multicast” names;
>>> each name can belong to only one bus peer. But remember that, if you do
>>> not specify DBUS_NAME_FLAG_DO_NOT_QUEUE when trying to register a name
>>> and it is already taken, then you will be placed in a queue to get it
>>> when the existing owner relinquishes it.
>>> 
>>> That way, anybody looking for “org.mpris.MediaPlayer2.musicplayer” only
>>> sees one. Quit that one, and the other should appear. After all, you
>>> only need one at a time, don’t you?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20210929/2af6e0b9/attachment.htm>


More information about the dbus mailing list