Bug 98722

Summary: No 'org.freedesktop.DBus.Error.PropertyWriteOnly' error
Product: dbus Reporter: nschoe <nschoe>
Component: coreAssignee: D-Bus Maintainers <dbus>
Status: RESOLVED MOVED QA Contact: D-Bus Maintainers <dbus>
Severity: normal    
Priority: medium CC: alejandro.vilicich, sebavts
Version: unspecified   
Hardware: All   
OS: All   
i915 platform: i915 features:

Description nschoe 2016-11-14 14:35:07 UTC
DBus properties can have 3 different access mode:

- readonly
- read
- write

When trying to set a new value to a `readonly` property, we get the DBus error: `org.freedesktop.DBus.Error.PropertyReadOnly`, but there is no such equivalent for trying to read a `write` property.

Admittedly this should not happen too often as I read that the use of write-only properties is discouraged, but since it is explicitly supported, I think we should provide a proper error.
Comment 1 Simon McVittie 2016-11-21 12:01:49 UTC
I'm going to assume that the change of assignee and QA contact was either spam or a mistake.

Please do not change the QA contact: we use that field to keep the D-Bus maintainers "in the loop" on all our bugs.

Please do not change the assignee unless you are a D-Bus maintainer, or you are actively working on a bug yourself and you intend to take responsibility for providing a full solution and resolving any issues raised by the maintainers during review.
Comment 2 Simon McVittie 2016-11-21 12:11:07 UTC
(In reply to nschoe from comment #0)
> When trying to set a new value to a `readonly` property, we get the DBus
> error: `org.freedesktop.DBus.Error.PropertyReadOnly`, but there is no such
> equivalent for trying to read a `write` property.

As a concrete example, let's suppose we have an object that implements this interface:

    interface com.example.HasProperties
        property ReadOnly: string, read-only, current value is "hello"
        property WriteOnly: string, write-only
        property Both: string, read/write, current value is "foo"

For Get("com.example.HasProperties", "WriteOnly") I think bindings have traditionally raised PermissionDenied? If you want to recommend something in the spec, please do a quick survey of major implementations. I don't think it's particularly important to define a separate error here, because as you say, write-only properties are weird and are probably best avoided.

For GetAll("com.example.HasProperties"), Bug #36190 proposes that object implementations should return (using the GVariant notation where <> is a variant):

      "ReadOnly": <"hello">,
      "Both": <"foo">,

and silently ignore their inability to fill in a value for WriteOnly. I think that's a good thing to do.
Comment 3 GitLab Migration User 2018-10-12 21:29:10 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/dbus/dbus/issues/160.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.