Why GVariant? (Re: Starting the kdbus discussions

Kay Sievers kay at vrfy.org
Thu Jan 2 06:02:21 PST 2014


On Thu, Jan 2, 2014 at 2:20 PM, rony <rony at wu.ac.at> wrote:

> Why did you chose to use a GVariant encoding and not sticking to the
> standardized and established dbus encoding? What were the pro and what were
> the cons arguments for that (surprising) decision?

Because it is similar enough to be not surprising and it solves quite
a lot of problems which the old D-Bus format has. It has sane
alignment rules, and it provides "seekable" data describing the
containers, and it not just a stream of bytes, and so on.

Read 2.1, 2.3.3, 2.3.4 in the document. It's by far the better choice
today. The Glib D-Bus code (which does not use libdbus) uses it
internally already, so there was already a major user today.

If we change the entire transport anyway with kdbus, we can switch to
the more efficient GVariant at the same time. The compat proxy will
provide the old marshalling for the old transport and re-marshal as
needed, so all should continue to work as it works today.

> Also, I was surprised to learn that (among other things) using GVariant one
> must not transfer strings that contain nul bytes (0x00) byte (cf. section
> 2.4.5 Strings in the above mentioned pdf)?
> Why is that?

Strings cannot *contain* \0., they are still \0 terminated.

Kay


More information about the dbus mailing list