You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

119 lines
4.9 KiB

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