Blame SOURCES/0001-main-Lower-fallback-warning-when-running-in-GDM.patch

52a515
From 51949dd2b944604742406a7464eb945cb5b610e9 Mon Sep 17 00:00:00 2001
52a515
From: Benjamin Berg <bberg@redhat.com>
52a515
Date: Mon, 15 Nov 2021 14:56:14 +0100
52a515
Subject: [PATCH 1/2] main: Lower fallback warning when running in GDM
52a515
52a515
It is currently expected for the fallback to happen. So hide the errors,
52a515
but still log a single message to inform users about it.
52a515
---
52a515
 gnome-session/main.c | 11 +++++++----
52a515
 1 file changed, 7 insertions(+), 4 deletions(-)
52a515
52a515
diff --git a/gnome-session/main.c b/gnome-session/main.c
52a515
index 443bc045..45ec6597 100644
52a515
--- a/gnome-session/main.c
52a515
+++ b/gnome-session/main.c
52a515
@@ -512,100 +512,103 @@ main (int argc, char **argv)
52a515
                 exit (1);
52a515
         }
52a515
 
52a515
         env_override_autostart_dirs = g_getenv ("GNOME_SESSION_AUTOSTART_DIR");
52a515
 
52a515
         if (env_override_autostart_dirs != NULL && env_override_autostart_dirs[0] != '\0') {
52a515
                 env_override_autostart_dirs_v = g_strsplit (env_override_autostart_dirs, ":", 0);
52a515
                 gsm_util_set_autostart_dirs (env_override_autostart_dirs_v);
52a515
         } else {
52a515
                 gsm_util_set_autostart_dirs (override_autostart_dirs);
52a515
 
52a515
                 /* Export the override autostart dirs parameter to the environment
52a515
                  * in case we are running on systemd. */
52a515
                 if (override_autostart_dirs) {
52a515
                         g_autofree char *autostart_dirs = NULL;
52a515
                         autostart_dirs = g_strjoinv (":", override_autostart_dirs);
52a515
                         g_setenv ("GNOME_SESSION_AUTOSTART_DIR", autostart_dirs, TRUE);
52a515
                 }
52a515
         }
52a515
 
52a515
         gsm_util_export_activation_environment (&error);
52a515
         if (error) {
52a515
                 g_warning ("Failed to upload environment to DBus: %s", error->message);
52a515
                 g_clear_error (&error);
52a515
         }
52a515
 
52a515
         session_name = opt_session_name;
52a515
 
52a515
 #ifdef HAVE_SYSTEMD
52a515
         gsm_util_export_user_environment (&error);
52a515
-        if (error) {
52a515
+        if (error && !g_getenv ("RUNNING_UNDER_GDM")) {
52a515
                 g_warning ("Failed to upload environment to systemd: %s", error->message);
52a515
                 g_clear_error (&error);
52a515
         }
52a515
 #endif
52a515
 
52a515
 #ifdef ENABLE_SYSTEMD_SESSION
52a515
         if (use_systemd && !systemd_service) {
52a515
                 g_autofree gchar *gnome_session_target;
52a515
                 const gchar *session_type;
52a515
 
52a515
                 session_type = g_getenv ("XDG_SESSION_TYPE");
52a515
 
52a515
                 /* We really need to resolve the session name at this point,
52a515
                  * which requires talking to GSettings internally. */
52a515
                 if (IS_STRING_EMPTY (session_name)) {
52a515
                         session_name = _gsm_manager_get_default_session (NULL);
52a515
                 }
52a515
 
52a515
                 /* Reset all failed units; we are going to start a lof ot things and
52a515
                  * really do not want to run into errors because units have failed
52a515
                  * in a previous session
52a515
                  */
52a515
                 gsm_util_systemd_reset_failed (&error);
52a515
-                if (error) {
52a515
+                if (error && !g_getenv ("RUNNING_UNDER_GDM")) {
52a515
                         g_warning ("Failed to reset failed state of units: %s", error->message);
52a515
                         g_clear_error (&error);
52a515
                 }
52a515
 
52a515
                 /* We don't escape the name (i.e. we leave any '-' intact). */
52a515
                 gnome_session_target = g_strdup_printf ("gnome-session-%s@%s.target", session_type, session_name);
52a515
                 if (gsm_util_start_systemd_unit (gnome_session_target, "fail", &error)) {
52a515
                         /* We started the unit, open fifo and sleep forever. */
52a515
                         systemd_leader_run ();
52a515
                         exit(0);
52a515
                 }
52a515
 
52a515
                 /* We could not start the unit, fall back. */
52a515
-                 g_warning ("Falling back to non-systemd startup procedure due to error: %s", error->message);
52a515
-                 g_clear_error (&error);
52a515
+                if (g_getenv ("RUNNING_UNDER_GDM"))
52a515
+                        g_message ("Falling back to non-systemd startup procedure. This is expected to happen for GDM sessions.");
52a515
+                else
52a515
+                        g_warning ("Falling back to non-systemd startup procedure due to error: %s", error->message);
52a515
+                g_clear_error (&error);
52a515
         }
52a515
 #endif /* ENABLE_SYSTEMD_SESSION */
52a515
 
52a515
         {
52a515
                 gchar *ibus_path;
52a515
 
52a515
                 ibus_path = g_find_program_in_path("ibus-daemon");
52a515
 
52a515
                 if (ibus_path) {
52a515
                         const gchar *p;
52a515
                         p = g_getenv ("QT_IM_MODULE");
52a515
                         if (!p || !*p)
52a515
                                 p = "ibus";
52a515
                         gsm_util_setenv ("QT_IM_MODULE", p);
52a515
                         p = g_getenv ("XMODIFIERS");
52a515
                         if (!p || !*p)
52a515
                                 p = "@im=ibus";
52a515
                         gsm_util_setenv ("XMODIFIERS", p);
52a515
                 }
52a515
 
52a515
                 g_free (ibus_path);
52a515
         }
52a515
 
52a515
         /* We want to use the GNOME menus which has the designed categories.
52a515
          */
52a515
         gsm_util_setenv ("XDG_MENU_PREFIX", "gnome-");
52a515
 
52a515
         /* Talk to logind before acquiring a name, since it does synchronous
52a515
          * calls at initialization time that invoke a main loop and if we
52a515
          * already owned a name, then we would service too early during
52a515
-- 
52a515
2.35.1
52a515