0-size array marshaling ?

Jean Parpaillon jean.parpaillon at free.fr
Mon Jul 4 13:43:12 UTC 2016


Hi,
I have question regarding (un)marhsaling of 0-size array.
Specifications (v0.26) says:
"A UINT32 giving the length of the array data in bytes, followed by
alignment padding to the alignment boundary of the array element type,
followed by each array element."

The question is: for 0-size array, is padding to the alignment boundary
of the array element type required ?
It seems that there are some differences between implementations.

My use case:
* my erlang code is calling a function with signature: 'sa(ysv)ui' 
 D-Bus implementation is https://github.com/lizenn/erlang-dbus
(marshaller: https://github.com/lizenn/erlang-dbus/blob/master/src/dbus
_marshaller.erl , includes unit test, in particular https://github.com/
lizenn/erlang-dbus/blob/master/src/dbus_marshaller.erl)
This DBus implementation pads 0-size array like any-size array.

* A Python implementation works fine: https://github.com/erocci/erocci_
backend_dbus/blob/master/test/dbus_python_SUITE_data/erocci_sample_back
end.py

* With the same function implemented in Java, I get: "Error Executing
Method org.ow2.erocci.backend.core.Collection: wrong number of
arguments"
Java uses dbus-java implementation from freedesktop (2.7 or 2.8 have
the same issue).
In debugging mode, I can see dbus-java do not get the latest argument
(integer 32).

* The error "wrong number of arguments" appears only when the array
input argument is empty.

I suspect the java dbus implementation to be wrong, as Python
implementation works and my erlang-dbus implementation is tested for
this precise case. 
Plus, this strange changelog message in dbus-java 2.8:
"* Fix array serialization issues (maybe!)"

Can anyone tell me:
1/ what is the correct interpretation of the D-Bus spec
2/ is the dbus-java implementation has been tested for this case

Regards,
-- 
Jean Parpaillon
--
Open Source Consultant
Director @ OW2 Consortium
OCCIware Strategic Orientation Committee Chairman
Research Engineer @ Inria
--
Phone: +33 6 30 10 92 86
im: jean.parpaillon at gmail.com
skype: jean.parpaillon
linkedin: http://www.linkedin.com/in/jeanparpaillon/en
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20160704/05c00558/attachment.html>


More information about the dbus mailing list