Crash when loading gnome-initial-setup session: g_dbus_proxy_call_sync() may return NULL without setting error
With the current F35 nightly image Fedora-Workstation-Live-x86_64-35-20210908.n.0.iso, after installing Fedora with anaconda, the gnome-initial-setup session sometimes crashes, displaying the "oh no, something has gone wrong!" screen. It's probably related to this selinux bug, but there is a GNOME bug here too. (Edit: it's not related, this happens even with selinux disabled.) The fail occurs because gsd-usb-protection-manager crashes after failing to make a D-Bus call. It's impossible to copy/paste the backtrace, but it looks like this:
Here's the thing: gsd-usb-protection-manager is not doing anything wrong. It crashes here in get_current_screen_saver_status():
ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (manager->screensaver_proxy),
"GetActive",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
manager->cancellable,
&error);
if (ret == NULL) {
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("Failed to get screen saver status: %s", error->message); // <-- crash is there
return;
}
The crash occurs when printing the error "Failed to get screen saver status: %s" because error
is NULL. Problem is, GLib's documentation guarantees error
must be set if g_dbus_proxy_call_sync() returns NULL, which it did here. So the gsd code is correct. One of our error paths in GDBus is not right.