Fatal warnings in client code
Thomas Kluyver
thomas at kluyver.me.uk
Mon Mar 6 12:20:05 UTC 2023
Hi all,
I helped someone work around VLC crashing when it tried to create a D-Bus message with a string that was not UTF-8 (probably loaded from a file without checking the encoding). The workaround was to set the environment variable DBUS_FATAL_WARNINGS=0 when running VLC.
There are a couple of similar issues on the VLC issue tracker, where a maintainer is adamant (and quite forthright) that this is a bug in libdbus:
https://code.videolan.org/videolan/vlc/-/issues/8390
https://code.videolan.org/videolan/vlc/-/issues/21354
I disagree with his reasoning (he says that the sender shouldn't validate messages), but it seems drastic for library code to call abort() and crash the entire application. Is this the intended behaviour, or has the application or the distro misconfigured something somewhere along the way?
The docs for the function in question say that it can return false if there's not enough memory, but don't mention any other failure conditions:
https://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#ga17491f3b75b3203f6fc47dcc2e3b221b
In terms of implementation, the public function calls _dbus_return_val_if_fail, which is a macro wrapping _dbus_warn_return_if_fail, which calls _dbus_warn_check_failed. The comment for that last function mentions 'Calling this means "there is a bug"' - should that mean only bugs in dbus itself, or also bugs in application code using it?
Thanks,
Thomas
More information about the dbus
mailing list