Blame SOURCES/0001-main-don-t-call-into-gdbus-before-setting-all-enviro.patch

cf6cdf
From 6294629686aed366210806a911016facd82a7fa7 Mon Sep 17 00:00:00 2001
cf6cdf
From: rpm-build <rpm-build>
cf6cdf
Date: Wed, 14 Feb 2018 09:50:56 -0500
cf6cdf
Subject: [PATCH] main: don't call into gdbus before setting all environment
cf6cdf
 variables
cf6cdf
cf6cdf
setenv () is not multi-thread safe so we need to avoid gsm_util_setenv
cf6cdf
calls (which fire off the glib worker thread) before we finish
cf6cdf
doing all our setenv() work.
cf6cdf
---
cf6cdf
 gnome-session/main.c | 9 +++++++--
cf6cdf
 1 file changed, 7 insertions(+), 2 deletions(-)
cf6cdf
cf6cdf
diff --git a/gnome-session/main.c b/gnome-session/main.c
cf6cdf
index b1ac385..bfcce83 100644
cf6cdf
--- a/gnome-session/main.c
cf6cdf
+++ b/gnome-session/main.c
cf6cdf
@@ -244,91 +244,96 @@ initialize_gio (void)
cf6cdf
         disable_fuse = g_strdup (g_getenv ("GVFS_DISABLE_FUSE"));
cf6cdf
         use_vfs = g_strdup (g_getenv ("GIO_USE_VFS"));
cf6cdf
 
cf6cdf
         g_setenv ("GVFS_DISABLE_FUSE", "1", TRUE);
cf6cdf
         g_setenv ("GIO_USE_VFS", "local", TRUE);
cf6cdf
         g_vfs_get_default ();
cf6cdf
 
cf6cdf
         if (use_vfs) {
cf6cdf
                 g_setenv ("GIO_USE_VFS", use_vfs, TRUE);
cf6cdf
                 g_free (use_vfs);
cf6cdf
         } else {
cf6cdf
                 g_unsetenv ("GIO_USE_VFS");
cf6cdf
         }
cf6cdf
 
cf6cdf
         if (disable_fuse) {
cf6cdf
                 g_setenv ("GVFS_DISABLE_FUSE", disable_fuse, TRUE);
cf6cdf
                 g_free (disable_fuse);
cf6cdf
         } else {
cf6cdf
                 g_unsetenv ("GVFS_DISABLE_FUSE");
cf6cdf
         }
cf6cdf
 }
cf6cdf
 
cf6cdf
 int
cf6cdf
 main (int argc, char **argv)
cf6cdf
 {
cf6cdf
         GError           *error = NULL;
cf6cdf
         static char     **override_autostart_dirs = NULL;
cf6cdf
         static char      *opt_session_name = NULL;
cf6cdf
         const char       *debug_string = NULL;
cf6cdf
         gboolean          gl_failed = FALSE;
cf6cdf
+        gboolean          needs_current_desktop_setenv = FALSE;
cf6cdf
         guint             name_owner_id;
cf6cdf
         GOptionContext   *options;
cf6cdf
         static GOptionEntry entries[] = {
cf6cdf
                 { "autostart", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &override_autostart_dirs, N_("Override standard autostart directories"), N_("AUTOSTART_DIR") },
cf6cdf
                 { "session", 0, 0, G_OPTION_ARG_STRING, &opt_session_name, N_("Session to use"), N_("SESSION_NAME") },
cf6cdf
                 { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
cf6cdf
                 { "failsafe", 'f', 0, G_OPTION_ARG_NONE, &failsafe, N_("Do not load user-specified applications"), NULL },
cf6cdf
                 { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL },
cf6cdf
                 /* Translators: the 'fail whale' is the black dialog we show when something goes seriously wrong */
cf6cdf
                 { "whale", 0, 0, G_OPTION_ARG_NONE, &please_fail, N_("Show the fail whale dialog for testing"), NULL },
cf6cdf
                 { "disable-acceleration-check", 0, 0, G_OPTION_ARG_NONE, &disable_acceleration_check, N_("Disable hardware acceleration check"), NULL },
cf6cdf
                 { NULL, 0, 0, 0, NULL, NULL, NULL }
cf6cdf
         };
cf6cdf
 
cf6cdf
         /* Make sure that we have a session bus */
cf6cdf
         if (!require_dbus_session (argc, argv, &error)) {
cf6cdf
                 gsm_util_init_error (TRUE, "%s", error->message);
cf6cdf
         }
cf6cdf
 
cf6cdf
         /* From 3.14 GDM sets XDG_CURRENT_DESKTOP. For compatibility with
cf6cdf
          * older versions of GDM,  other display managers, and startx,
cf6cdf
          * set a fallback value if we don't find it set.
cf6cdf
          */
cf6cdf
         if (g_getenv ("XDG_CURRENT_DESKTOP") == NULL) {
cf6cdf
-            g_setenv("XDG_CURRENT_DESKTOP", "GNOME", TRUE);
cf6cdf
-            gsm_util_setenv ("XDG_CURRENT_DESKTOP", "GNOME");
cf6cdf
+                g_setenv ("XDG_CURRENT_DESKTOP", "GNOME", TRUE);
cf6cdf
+                needs_current_desktop_setenv = TRUE;
cf6cdf
         }
cf6cdf
 
cf6cdf
         /* Make sure we initialize gio in a way that does not autostart any daemon */
cf6cdf
         initialize_gio ();
cf6cdf
 
cf6cdf
+        if (needs_current_desktop_setenv) {
cf6cdf
+                gsm_util_setenv ("XDG_CURRENT_DESKTOP", "GNOME");
cf6cdf
+        }
cf6cdf
+
cf6cdf
         setlocale (LC_ALL, "");
cf6cdf
         bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
cf6cdf
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
cf6cdf
         textdomain (GETTEXT_PACKAGE);
cf6cdf
 
cf6cdf
         debug_string = g_getenv ("GNOME_SESSION_DEBUG");
cf6cdf
         if (debug_string != NULL) {
cf6cdf
                 debug = atoi (debug_string) == 1;
cf6cdf
         }
cf6cdf
 
cf6cdf
         error = NULL;
cf6cdf
         options = g_option_context_new (_(" — the GNOME session manager"));
cf6cdf
         g_option_context_add_main_entries (options, entries, GETTEXT_PACKAGE);
cf6cdf
         g_option_context_parse (options, &argc, &argv, &error);
cf6cdf
         if (error != NULL) {
cf6cdf
                 g_warning ("%s", error->message);
cf6cdf
                 exit (1);
cf6cdf
         }
cf6cdf
 
cf6cdf
         g_option_context_free (options);
cf6cdf
 
cf6cdf
         /* Rebind stdout/stderr to the journal explicitly, so that
cf6cdf
          * journald picks ups the nicer "gnome-session" as the program
cf6cdf
          * name instead of whatever shell script GDM happened to use.
cf6cdf
          */
cf6cdf
 #ifdef ENABLE_SYSTEMD_JOURNAL
cf6cdf
         if (!debug) {
cf6cdf
                 int journalfd;
cf6cdf
 
cf6cdf
                 journalfd = sd_journal_stream_fd (PACKAGE, LOG_INFO, 0);
cf6cdf
-- 
cf6cdf
2.14.3
cf6cdf