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

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