[Pkg-utopia-maintainers] Bug#495005: libdbus complaining unconditionally on stderr

Simon McVittie smcv at debian.org
Mon Sep 25 19:49:42 UTC 2017


Control: tags 495005 + wontfix

Sorry to resurrect an ancient bug report, but I'm trying to do some
triaging on src:dbus bugs.

On Sun, 29 Nov 2009 at 10:14:41 +0100, Julien BLACHE wrote:
> Michael Biebl <biebl at debian.org> wrote:
> > Could you actually show me, where (lib)dbus is at fault here?
> 
> #516982 msg#35

which quotes a message from #20, further up the bug:

process 20186: arguments to dbus_connection_send() were incorrect,
assertion "connection != NULL" failed in file dbus-connection.c line 3099.
This is normally a bug in some application using the D-Bus library.

> Debug messages shouldn't be printed by the library unless it's a debug
> build or the application asked for (allowed) them.

This is not a debug message, it's a warning of undefined behaviour having
been reached. In the default upstream configuration of libdbus it would
immediately have been followed by abort() (although Debian's libdbus is
patched to make these "checks" non-fatal by default; it isn't entirely
clear to me why this was done, and one day I might take that patch out).
Think of it as analogous to how glibc writes to stderr when it detects
memory corruption.

Something in the process in question is calling
dbus_connection_send(NULL, ?, ?), which is considered to be invalid in
the same way as (for example) fprintf(NULL, "hello") (which segfaults,
at least on my system).

If users of libdbus don't want undefined behaviour (which could include
messages on stderr, abort(), NULL pointer dereferences or whatever) then
they should not pass NULL to a function that is conceptually a method on
a (non-NULL) connection.

>From comments on #516982 it seems that the cause is failure to connect to
the dbus-daemon, so dbus_bus_get() or dbus_bus_get_private() returned
NULL. The correct response to that happening is to stop trying to
interact with D-Bus, and either exit unsuccessfully (if interacting with
D-Bus is a required part of this program's functionality) or skip the
D-Bus bits (if interacting with D-Bus is not critical for this program).

Regards,
    smcv



More information about the Pkg-utopia-maintainers mailing list