[Patch] Moving FD passing into the header

Havoc Pennington hp at pobox.com
Tue Jun 22 17:17:07 PDT 2010


Hi,

On Tue, Jun 22, 2010 at 6:32 AM, Christian Dywan <christian at lanedo.com> wrote:
> That still leaves the aspect that it will no longer be possible to
> serialize and copy messages according to their signature. FD is
> not a flat type in the same way as an integer. It can't be stored on
> disk. It can't be passed over the network. The only thing you can do is
> pass it over the bus, which is what the explicit API allows.
>
> The breach in consistency will be the same in GVariant, which can
> serialize all contained types *except for* h.
>
> And of course the type system stops being platform agnostic.
>

this seems like a technicality. If you have an integer which is an
index into the header, then the type of that is still "file descriptor
index in the header" - rather than "just an integer"

That is, the operations on the type that make sense are those that
make sense for a file descriptor index, not those that make sense for
an integer. Would it make sense to add/subtract/do math on this index?
no. The only thing that would make sense would be to use it to do a
header lookup. type is defined by supported operations.

So passing a message that has an fd index in it over the network or
serializing such a message or whatever would just be wrong. Right?
When would it be OK?

If the type signature has "i" then it will "work" but be useless and wrong.

If it has "h" then GVariant could throw an error about how h is not a
type it knows about, which would be right.

Or, for GVariant to be used as a dbus API, GVariant would have to
throw the error on an attempt to serialize to something other than a
local socket.

Alternatively GVariant could treat "h" as "i" and the user of GVariant
would have to somehow manually handle fds. I don't know if that's
feasible.

Basically it seems like what breaks dbus-via-GVariant here is trying
to have fds in messages, not the manner in which the fds are in the
messages.

Or if not doing dbus-via-GVariant, I don't see why GVariant needs to
have the 'h' type at all, it could just puke on it and that would be
logical.

As a thought experiment, if GVariant just treated 'h' the same as 'i'
always, would anything be different from putting the fd in the header?

Havoc


More information about the dbus mailing list