Merge lp:~3v1n0/gnome-session/upstart-export-variables into lp:~ubuntu-desktop/gnome-session/ubuntu

Proposed by Marco Trevisan (Treviño) on 2016-04-28
Status: Merged
Merged at revision: 336
Proposed branch: lp:~3v1n0/gnome-session/upstart-export-variables
Merge into: lp:~ubuntu-desktop/gnome-session/ubuntu
Diff against target: 106 lines (+86/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/export_env_to_upstart.patch (+78/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~3v1n0/gnome-session/upstart-export-variables
Reviewer Review Type Date Requested Status
VCS imports 2016-04-28 Pending
Review via email: mp+293236@code.launchpad.net

Commit message

debian/patches/export_env_to_upstart.patch:
  - Export environment variables to upstart as well, if available

To post a comment you must log in.
337. By Marco Trevisan (Treviño) on 2016-04-28

debian/patches/export_env_to_upstart.patch: update infos about the forwarding status

Marco Trevisan (Treviño) (3v1n0) wrote :

In terms of calls duration, this is what I'm getting (when using logging before calls as shown in http://paste.ubuntu.com/16378057/):

gsm_util_setenv: LC_TIME='it_IT.UTF-8'
Dbus env update duration 20.416000 ms
Upstart env update duration 76.193000 ms

gsm_util_setenv: LC_NUMERIC='it_IT.UTF-8'
Dbus env update duration 11.500000 ms
Upstart env update duration 19.927000 ms

gsm_util_setenv: LC_MONETARY='it_IT.UTF-8'
Dbus env update duration 17.485000 ms
Upstart env update duration 26.957000 ms

gsm_util_setenv: LC_MEASUREMENT='it_IT.UTF-8'
Dbus env update duration 70.707000 ms
Upstart env update duration 22.770000 ms

gsm_util_setenv: LC_PAPER='it_IT.UTF-8'
Dbus env update duration 8.911000 ms
Upstart env update duration 4.370000 ms

gsm_util_setenv: QT_IM_MODULE='ibus'
Dbus env update duration 1.217000 ms
Upstart env update duration 2.675000 ms

gsm_util_setenv: XMODIFIERS='@im=ibus'
Dbus env update duration 1.165000 ms
Upstart env update duration 2.649000 ms

gsm_util_setenv: GNOME_DESKTOP_SESSION_ID='this-is-deprecated'
Dbus env update duration 1.074000 ms
Upstart env update duration 2.670000 ms

gsm_util_setenv: XDG_MENU_PREFIX='gnome-'
Dbus env update duration 2.086000 ms
Upstart env update duration 1.818000 ms

gsm_util_setenv: SESSION_MANAGER='local/ubuntu-vmware:@/tmp/.ICE-unix/5129,unix/ubuntu-vmware:/tmp/.ICE-unix/5129'
Dbus env update duration 1.219000 ms
Upstart env update duration 0.515000 ms

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-11-11 23:34:19 +0000
3+++ debian/changelog 2016-04-28 10:51:43 +0000
4@@ -1,3 +1,10 @@
5+gnome-session (3.18.1.2-1ubuntu2) UNRELEASED; urgency=medium
6+
7+ * debian/patches/export_env_to_upstart.patch:
8+ - Export environment variables to upstart as well, if available (LP: #1433013)
9+
10+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Thu, 28 Apr 2016 12:13:32 +0200
11+
12 gnome-session (3.18.1.2-1ubuntu1) xenial; urgency=medium
13
14 * Merge from Debian unstable. Remaining changes (LP: #1512914):
15
16=== added file 'debian/patches/export_env_to_upstart.patch'
17--- debian/patches/export_env_to_upstart.patch 1970-01-01 00:00:00 +0000
18+++ debian/patches/export_env_to_upstart.patch 2016-04-28 10:51:43 +0000
19@@ -0,0 +1,78 @@
20+Description: Export environment variables to upstart as well, if available
21+Author: Marco Trevisan <marco.trevisan@canonical.com>
22+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=765717
23+Bug-Ubuntu: https://launchpad.net/bugs/1433013
24+Forwarded: yes
25+
26+Index: gnome-session-3.18.1.2/gnome-session/gsm-util.c
27+===================================================================
28+--- gnome-session-3.18.1.2.orig/gnome-session/gsm-util.c
29++++ gnome-session-3.18.1.2/gnome-session/gsm-util.c
30+@@ -491,6 +491,52 @@ gsm_util_update_activation_environment (
31+ return environment_updated;
32+ }
33+
34++static gboolean
35++gsm_util_update_upstart_environment (const char *variable,
36++ const char *value,
37++ GError **error)
38++{
39++ GDBusConnection *connection;
40++ gboolean environment_updated;
41++ GVariant *reply;
42++ GError *bus_error = NULL;
43++ gchar *environment_string;
44++
45++ environment_updated = FALSE;
46++ connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error);
47++
48++ if (connection == NULL) {
49++ return FALSE;
50++ }
51++
52++ environment_string = g_strdup_printf ("%s=%s", variable, value);
53++ reply = g_dbus_connection_call_sync (connection,
54++ "com.ubuntu.Upstart",
55++ "/com/ubuntu/Upstart",
56++ "com.ubuntu.Upstart0_6",
57++ "SetEnv",
58++ g_variant_new ("(@assb)",
59++ g_variant_new_array (G_VARIANT_TYPE_STRING, NULL, 0),
60++ environment_string,
61++ TRUE),
62++ NULL,
63++ G_DBUS_CALL_FLAGS_NONE,
64++ -1, NULL, &bus_error);
65++
66++
67++ if (bus_error != NULL) {
68++ g_propagate_error (error, bus_error);
69++ } else {
70++ environment_updated = TRUE;
71++ g_variant_unref (reply);
72++ }
73++
74++ g_clear_object (&connection);
75++ g_free (environment_string);
76++
77++ return environment_updated;
78++}
79++
80+ void
81+ gsm_util_setenv (const char *variable,
82+ const char *value)
83+@@ -509,6 +555,13 @@ gsm_util_setenv (const char *variable,
84+ */
85+ if (!gsm_util_update_activation_environment (variable, value, &bus_error)) {
86+ g_warning ("Could not make bus activated clients aware of %s=%s environment variable: %s", variable, value, bus_error->message);
87+- g_error_free (bus_error);
88++ g_clear_error (&bus_error);
89++ }
90++
91++ if (g_getenv ("UPSTART_SESSION") != NULL) {
92++ if (!gsm_util_update_upstart_environment (variable, value, &bus_error)) {
93++ g_warning ("Could not make upstart activated jobs aware of %s=%s environment variable: %s", variable, value, bus_error->message);
94++ g_clear_error (&bus_error);
95++ }
96+ }
97+ }
98
99=== modified file 'debian/patches/series'
100--- debian/patches/series 2015-06-05 19:54:05 +0000
101+++ debian/patches/series 2016-04-28 10:51:43 +0000
102@@ -6,3 +6,4 @@
103 53_add_sessionmigration.patch
104 95_dbus_request_shutdown.patch
105 103_kill_the_fail_whale.patch
106+export_env_to_upstart.patch

Subscribers

People subscribed via source and target branches