diff options
author | Ray Strode <rstrode@redhat.com> | 2023-04-20 17:14:19 -0400 |
---|---|---|
committer | Ray Strode <halfline@gmail.com> | 2023-05-16 15:03:09 +0000 |
commit | 3503910fa447a399d9444c1b10da513bf3c0ccd8 (patch) | |
tree | 833dcf54fd8e21162368d8685df7f0950542db6e /libgdm | |
parent | 23632753a6a8fed3f71441445afa23f53fb555ea (diff) | |
download | gdm-3503910fa447a399d9444c1b10da513bf3c0ccd8.tar.gz |
libgdm: Fix session loading precedence
One feature that GDM is supposed to support is a precedence order
for loading xsession files.
If someone has a file in /etc/X11/sessions it's supposed to override
a file in /usr/share/xsessions.
This works okay from a backend point of view. /etc/X11/sessions can
change the command getting run, for instance, but it doesn't work
from a front end point of view. Menu items can't get hidden in
the session cog.
This is due to a bug in libgdm where it inadvertently gives
/usr/share/xsessions higher precedence than /etc/X11/sessions.
This commit fixes that by processing the lists in reverse order,
and making sure to remove already added entries if overriding
entries are hidden.
Diffstat (limited to 'libgdm')
-rw-r--r-- | libgdm/gdm-sessions.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c index d8b4d5cd..c3aeafdd 100644 --- a/libgdm/gdm-sessions.c +++ b/libgdm/gdm-sessions.c @@ -143,6 +143,7 @@ load_session_file (const char *id, if (!key_file_is_relevant (key_file)) { g_debug ("\"%s\" is hidden or contains non-executable TryExec program\n", path); + g_hash_table_remove (gdm_available_sessions_map, id); goto out; } @@ -322,7 +323,7 @@ collect_sessions (void) } if (!supported_session_types || g_strv_contains ((const char * const *) supported_session_types, "x11")) { - for (i = 0; i < xorg_search_array->len; i++) { + for (i = xorg_search_array->len - 1; i >= 0; i--) { collect_sessions_from_directory (g_ptr_array_index (xorg_search_array, i)); } } @@ -330,7 +331,7 @@ collect_sessions (void) #ifdef ENABLE_WAYLAND_SUPPORT #ifdef ENABLE_USER_DISPLAY_SERVER if (!supported_session_types || g_strv_contains ((const char * const *) supported_session_types, "wayland")) { - for (i = 0; i < wayland_search_array->len; i++) { + for (i = wayland_search_array->len - 1; i >= 0; i--) { collect_sessions_from_directory (g_ptr_array_index (wayland_search_array, i)); } } |