Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zeenix opened this issue Dec 30, 2022 · 2 comments · Fixed by #459
Closed

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

zeenix opened this issue Dec 30, 2022 · 2 comments · Fixed by #459
Labels
enhancement New feature or request good first issue Good for newcomers trivial
Milestone

Comments

@zeenix
Copy link
Contributor

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
Contributor 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
Contributor 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. 😞

@zeenix zeenix added good first issue Good for newcomers and removed 4. newcomers labels May 13, 2023
zeenix added a commit to mercedes-benz/zbus that referenced this issue Aug 31, 2023
According to the spec:

> An empty string may be provided for the interface name; in this case, if
> there are multiple properties on an object with the same name, the
> results are undefined (picking one by according to an arbitrary
> deterministic rule, or returning an error, are the reasonable
> possibilities).

Fixes dbus2#302.
@zeenix zeenix added this to the zbus-4.0 milestone Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers trivial
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant