should request_name org.freedesktop.DBus fail?

Robert McQueen robert.mcqueen at collabora.co.uk
Wed Nov 9 04:13:34 PST 2005


Havoc Pennington wrote:
> Not a bug. As soon as a _dbus_return_if_fail() trips, that means your
> program is broken - we behave exactly as if you passed in unallocated
> memory or other garbage. All behavior is undefined as soon as
> _dbus_return_if_fail() happens.
>snip<
> Anyhow, _dbus_return_if_fail()/g_return_if_fail() are like
> NullPointerException. DBusError is like IOException.

All fair points, and I'll change the Python bindings so that a return of
0 from the library function throws you an unchecked exception like
ValueError. The reason I asked was the inconsistency. If you send a
message to RequestName manually, with a valid UTF-8 string, but an
invalid name, you get an error reply from the bus daemon explaining the
error of your ways. However, if you call request_name in the library
with the same value, it barfs, prints rudeness to the console, and
returns a value to your program that's not written in the API
documentation. It just seemed a little unusual when I ran into it, but
I'll accept your argument that this is how it should be.

> Havoc

Regards,
Rob


More information about the dbus mailing list