Contradiction in bus names naming in D-Bus spec

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Sun Jan 31 22:01:48 UTC 2021


On Sun, 31 Jan 2021 15:15:31 +0300, Igor Plastov wrote:

> It looks like I had found contradiction in  bus names rules (
> https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-messages),
> 2nd naming rule says:
> **Bus names are composed of 1 or more elements separated by a period
> ('.') character. All elements must contain at least one character.*
> 
> 4th naming rules:
> **Bus names must contain at least one '.' (period) character (and
> thus at least two elements).  *
> 
> What is the right way of understanding of this two rules?

Follow what libdbus does. It is the reference implementation, after all:

    ldo at theon:~> python3 -ic "import dbussy"
    >>> dbussy.validate_bus_name("a.b")
    True
    >>> dbussy.validate_bus_name("a")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/ldo/projects/dbussy/dbussy.py", line 5826, in validate_bus_name
        my_error.raise_if_set()
      File "/home/ldo/projects/dbussy/dbussy.py", line 5035, in raise_if_set
        raise DBusError(self.name, self.message)
    dbussy.DBusError: org.freedesktop.DBus.Error.InvalidArgs -- Bus name was not valid: 'a'


More information about the dbus mailing list