Subject: Re: bug#37831: GDM has a GNOME entry even when not installed

From: Ludovic Courtès <[email-masked]>
Date: Sat, 11 Apr 2020 18:31:48 +0200

Hi,

Pierre Neidhardt <[email-masked]> skribis:

> My config.scm installs EXWM + StumpWM, but not GNOME.
> Before the last core-update, GDM would only suggest the 2 window
> managers.
>
> After a recent Guix pull followed by a `guix system reconfigure', GDM
> also suggests GNOME.  If I select it, it fails to log in, which I
> suppose is expected since it's not installed.
>
> I believe the GNOME entry in GDM should only appear if GNOME is installed.

I investigated this issue.

‘collect_sessions’ in ‘gdm-sessions.c’ does this:

--8<---------------cut here---------------start------------->8---
const char *xorg_search_dirs[] = {
        "/etc/X11/sessions/",
        DMCONFDIR "/Sessions/",
        DATADIR "/gdm/BuiltInSessions/",
        DATADIR "/xsessions/",
        NULL
};

xorg_search_array = g_array_new (TRUE, TRUE, sizeof (char *));

const gchar * const *system_data_dirs = g_get_system_data_dirs ();

for (i = 0; system_data_dirs[i]; i++) {
        session_dir = g_build_filename (system_data_dirs[i], "xsessions", NULL);
        g_array_append_val (xorg_search_array, session_dir);
}

g_array_append_vals (xorg_search_array, xorg_search_dirs, G_N_ELEMENTS (xorg_search_dirs));

if (gdm_available_sessions_map == NULL) {
        gdm_available_sessions_map = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                            g_free, (GDestroyNotify)gdm_session_file_free);
}

for (i = 0; i < xorg_search_array->len; i++) {
        collect_sessions_from_directory (g_array_index (xorg_search_array, gchar*, i));
}
--8<---------------cut here---------------end--------------->8---

‘gnome-desktop.desktop’, which contains the GNOME entry, is picked up
from $(guix build gnome-session)/share/xsessions, which happens to be
one of the ‘system_data_dirs’ elements (via $XDG_DATA_DIR).

So I thought that setting:

  system_data_dirs = { NULL };

would solve the issue.  Alas, it seems that when we do that, either the
array remains empty or somehow ‘collect_sessions_from_directory’ is not
called.

I can’t attach GDM though, or I don’t know what to attach it to…

Ideas anyone?

Thanks,
Ludo’.