Properties.Get fallibility

Illia Volchanetskyi6439 Illia_Volchanetskyi6439 at Jabil.com
Thu Jul 27 15:04:24 UTC 2023


Hello,



Is replying with an error to an org.freedesktop.DBus.Properties.Get call okay? I assumed that it was and now I am running into some difficulties.



My reasoning was that since method calls may be replied with ERROR message type, "Get" is a method, and the D-Bus specification (section org.freedesktop.DBus.Properties) does not forbid that, it should not be wrong.



The first issue is GetAll implementation. As per spec:

> If it is called with a valid interface name for which some properties are not accessible to the caller (for example, due to per-property access control implemented in the service), those properties should be silently omitted from the result array.

I am not sure if this statement covers the case where an error occurs (due to some failure, not just denied access) while trying to read one of the properties. It probably does not. The library that I am using, which implements GetAll for me, replies with the error to GetAll calls in this case, which makes GetAll less useful as the "client" would have to fall back to reading the properties one by one with Get.



If I recall correctly, busctl introspect would even omit the interface from the output if one of its properties failed to read.



The last issue is InterfacesAdded not being emitted, which I am relying upon. The signal must include the properties and their values. Similarly to GetAll, the expected behaviour in case of an error is not clear to me. Not sending the signal at all does not look good to me.



Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20230727/d0237504/attachment.htm>


More information about the dbus mailing list