Skip Menu |

This queue is for tickets about the Net-DBus CPAN distribution.

Report information
The Basics
Id: 74038
Status: resolved
Priority: 0/
Queue: Net-DBus

People
Owner: Nobody in particular
Requestors: squentin [...] free.fr
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.0.0
Fixed in: (no value)



Subject: org.freedesktop.DBus.Properties.GetAll doesn't return values as variants
Although the GetAll method is declared as [["dict", "string", ["variant"]]] it doesn't force the type of the return value. So the return type is whatever the guessing system choose, which seems to only work if all the properties are of the same type. This make my app (which worked with v0.33.6) crash with messages like : process 4657: Array or variant type requires that type boolean be written, but int64 was written. The overall signature expected here was 'a{sb}' and we are on byte 4 of that signature. I made it work with the attached patch, but you might want to do it differently.
Subject: GetAll.diff
--- a/lib/Net/DBus/Object.pm +++ b/lib/Net/DBus/Object.pm @@ -616,7 +616,14 @@ my $reply = $connection->make_method_return_message($message); - $self->_introspector->encode($reply, "methods", "Get", "returns", \%values); + my $Vtype= + [ &Net::DBus::Binding::Message::TYPE_DICT_ENTRY, + [ &Net::DBus::Binding::Message::TYPE_STRING, + [ &Net::DBus::Binding::Message::TYPE_VARIANT, + [], + ]]]; + my $values= Net::DBus::Binding::Value->new($Vtype,\%values); + $self->_introspector->encode($reply, "methods", "Get", "returns", $values); return $reply; }
From: squentin [...] free.fr
In fact the bug is simpler that I thought, simply replacing "Get" by "GetAll" in the line : $self->_introspector->encode($reply, "methods", "Get", "returns", \%values); in the _dispatch_all_prop_read() function fixes it.
This is fixed as you described with commit b2163586b0f888de2c1563e20b7befff670d6a70 Author: Pali <pali@cpan.org> Date: Thu Nov 14 18:31:13 2019 +0100 Fix encoding and decoding of properties via GetAll method