Subject: Re: bug#43252: 27.1; DBus properties lack type hints or overrides

From: Michael Albinus <[email-masked]>
Date: Fri, 18 Sep 2020 17:50:45 +0200

Michael Albinus <[email-masked]> writes:

Hi Hugh,

>> + (should ; This should error or the next get should fail
>> +         (equal
>> +          (dbus-set-property
>> +           :session dbus--test-service dbus--test-path
>> +           dbus--test-interface "ByteValue" 1024)
>> +          1024))
>
> No error expected. You haven't given 1024 a type (like :byte), so it is
> handled as :uint32.

And even if you would have prefixed the value with :byte, there won't be
an error. In dbusbind.c, byte values are simply computed by taking the
modulo 255:

	  unsigned char val = XFIXNAT (object) & 0xFF;

":byte 1024" is equal to ":byte 4". Similar conversions happen for the
other basic types, based on numbers.

Maybe we could add some tests for these conversions? Since they are not
restricted to property handling, (a) new test(s) dbus-test01-* would help.

>> Cheers,
>> Hugh

Best regards, Michael.