GNOME Bugzilla – Bug 697594
race with logind for finding our seat
Last modified: 2013-04-09 19:55:42 UTC
So I was debugging why https://bugzilla.gnome.org/show_bug.cgi?id=697292 caused me to get into initial setup mode each time. It appears to be because libaccountsservice can't find the current session (sometimes, it's racy), it says "giving up, setting the loaded property", which then in turn means we don't have any users yet, and then we get initial setup. I think the race condition is with logind writing out the updated seat file when the session becomes active. Verifying now.
Ok, I think this is quite simple - there is no session until the greeter starts, and to determine which greeter mode we should use, we need a session. Looks like an accountsservice bug to me; why should we need to be in an active session to enumerate users?
I tried this patch, but it always fails because the daemon has no XDG_SESSION_ID. diff --git a/src/libaccountsservice/act-user-manager.c b/src/libaccountsservice/act-user-manager.c index 502df0e..d171fbc 100644 --- a/src/libaccountsservice/act-user-manager.c +++ b/src/libaccountsservice/act-user-manager.c @@ -1006,20 +1006,17 @@ on_get_current_session_finished (GObject *object, static void _get_current_systemd_session_id (ActUserManager *manager) { - char *session_id; - int res; + const char *session_id; - res = sd_seat_get_active ("seat0", &session_id, NULL); + session_id = g_getenv ("XDG_SESSION_ID"); - if (res < 0) { - g_debug ("Failed to identify the current session: %s", - strerror (-res)); + if (session_id == NULL) { + g_debug ("Failed to identify the current session (no XDG_SESSION_ID)"); unload_seat (manager); return; } manager->priv->seat.session_id = g_strdup (session_id); - free (session_id); manager->priv->seat.state++;
libaccountsservice clearly makes assumptions about being used inside a session. But the slave runs outside the greeter session. Can we just use accountsservice dbus api direction, and avoid the library in the slave ?
Created attachment 241005 [details] [review] 0001-slave-List-users-directly-via-DBus-don-t-use-libacco.patch
Went with a modified patch from Jasper.