Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Support "" as interface name in org.freedesktop.DBus.Properties GetAll method #312

Open
zeenix opened this issue Dec 30, 2022 · 2 comments
Labels
4. newcomers Tasks that are good for new contributors enhancement New feature or request trivial

Comments

@zeenix
Copy link
Collaborator

zeenix commented Dec 30, 2022

In GitLab by @zevweiss on Dec 30, 2022, 05:50

While it's a bit light on description of exactly what the semantics are, the dbus spec does say that "[a]n empty string may be provided for the interface name" for the methods of the org.freedesktop.DBus.Properties interface. Inspecting the libsdbus implementation as a reference (here and here), it looks like it only supports it for GetAll, and just returns the union of all properties on all interfaces. (Given the lack of implementation there, I assume that Get and Set with an empty interface_name argument is not widely used.)

At present, calling GetAll with an empty string as the interface name produces an error:

Invalid interface or error name: `` is 0 characters long, which is smaller than minimum allowed (3)

@zeenix
Copy link
Collaborator Author

zeenix commented Dec 30, 2022

You're right. That was an oversight I believe. The argument here should be Optional<InterfaceName<'_>> instead. However, I think for backwards-compat and keeping in mind that this is a very niche use case (I think), we should add another wrapper (e.g get_all_optional) that takes the more correct type and with #[dbus_proxy(name = "GetAll"] attribute so it's the same method call underneath.

@zeenix
Copy link
Collaborator Author

zeenix commented Dec 30, 2022

In case you (or anyone else) decide to handle this before I get a chance, keep in mind that's the zvariant::Optional we need to use, as unfortunately Option is not an option. 😞

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4. newcomers Tasks that are good for new contributors enhancement New feature or request trivial
Projects
None yet
Development

No branches or pull requests

1 participant