Merge lp:~josharenson/lightdm/withhold-invalid-x-args into lp:lightdm

Proposed by Josh Arenson on 2016-04-12
Status: Needs review
Proposed branch: lp:~josharenson/lightdm/withhold-invalid-x-args
Merge into: lp:lightdm
Diff against target: 92 lines (+31/-7)
3 files modified
src/seat-unity.c (+6/-0)
src/x-server-local.c (+23/-7)
src/x-server-local.h (+2/-0)
To merge this branch: bzr merge lp:~josharenson/lightdm/withhold-invalid-x-args
Reviewer Review Type Date Requested Status
Robert Ancell 2016-04-12 Needs Information on 2016-04-26
PS Jenkins bot continuous-integration Approve on 2016-04-12
Review via email: mp+291648@code.launchpad.net

Commit message

Prevent passing arguments meant for XMir to X

Description of the change

seat-unity falls back on X if XMir can't be found, however x-server-local passes XMir specific arguments. This breaks pure X sessions. This patch aims to fix that.

To post a comment you must log in.
2301. By Josh Arenson on 2016-04-12

Prevent passing arguments meant for XMir to X

PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Michael Terry (mterry) wrote :

Diff looks sensible. But Robert knows the score here better than me.

Robert Ancell (robert-ancell) wrote :

I'm not sure the problem that's being solved here. This particular code was to support the transition between the way XMir worked. Originally it was an option in /usr/bin/X, then it was changed to have a separate binary /usr/bin/Xmir.

I've dropped this legacy support in trunk.

review: Needs Information

Unmerged revisions

2301. By Josh Arenson on 2016-04-12

Prevent passing arguments meant for XMir to X

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/seat-unity.c'
2--- src/seat-unity.c 2015-10-16 10:20:03 +0000
3+++ src/seat-unity.c 2016-04-12 16:11:53 +0000
4@@ -205,7 +205,13 @@
5 command = seat_get_string_property (seat, "xmir-command");
6 /* Fall back to using X if Xmir is not available as this was the previous way XMir worked */
7 if (strcmp (command, "Xmir") == 0 && !g_find_program_in_path ("Xmir"))
8+ {
9 command = seat_get_string_property (seat, "xserver-command");
10+ x_server_local_set_is_xmir (x_server, FALSE);
11+ }
12+ else
13+ x_server_local_set_is_xmir(x_server, TRUE);
14+
15 x_server_local_set_command (x_server, command);
16
17 id = g_strdup_printf ("x-%d", SEAT_UNITY (seat)->priv->next_x_server_id);
18
19=== modified file 'src/x-server-local.c'
20--- src/x-server-local.c 2015-10-28 03:22:31 +0000
21+++ src/x-server-local.c 2016-04-12 16:11:53 +0000
22@@ -68,6 +68,9 @@
23 gint vt;
24 gboolean have_vt_ref;
25
26+ /* Xmir or fallback to X */
27+ gboolean is_xmir;
28+
29 /* Background to set */
30 gchar *background;
31 };
32@@ -326,6 +329,13 @@
33 }
34
35 void
36+x_server_local_set_is_xmir (XServerLocal *server, gboolean is_xmir)
37+{
38+ g_return_if_fail (server != NULL);
39+ server->priv->is_xmir = is_xmir;
40+}
41+
42+void
43 x_server_local_set_mir_id (XServerLocal *server, const gchar *id)
44 {
45 g_return_if_fail (server != NULL);
46@@ -525,13 +535,6 @@
47 if (server->priv->authority_file)
48 g_string_append_printf (command, " -auth %s", server->priv->authority_file);
49
50- /* Setup for running inside Mir */
51- if (server->priv->mir_id)
52- g_string_append_printf (command, " -mir %s", server->priv->mir_id);
53-
54- if (server->priv->mir_socket)
55- g_string_append_printf (command, " -mirSocket %s", server->priv->mir_socket);
56-
57 /* Connect to a remote server using XDMCP */
58 if (server->priv->xdmcp_server != NULL)
59 {
60@@ -555,6 +558,19 @@
61 if (server->priv->background)
62 g_string_append_printf (command, " -background %s", server->priv->background);
63
64+ /* Setup for running inside Mir */
65+
66+ /* If running x instead of xmir, the following args will cause X to fail to start, so they are ignored, but still passed */
67+ if (!server->priv->is_xmir)
68+ g_string_append_printf(command, " -I");
69+
70+ if (server->priv->mir_id)
71+ g_string_append_printf (command, " -mir %s", server->priv->mir_id);
72+
73+ if (server->priv->mir_socket)
74+ g_string_append_printf (command, " -mirSocket %s", server->priv->mir_socket);
75+
76+
77 process_set_command (server->priv->x_server_process, command->str);
78 g_string_free (command, TRUE);
79
80
81=== modified file 'src/x-server-local.h'
82--- src/x-server-local.h 2015-10-14 16:00:30 +0000
83+++ src/x-server-local.h 2016-04-12 16:11:53 +0000
84@@ -77,6 +77,8 @@
85
86 const gchar *x_server_local_get_authority_file_path (XServerLocal *server);
87
88+void x_server_local_set_is_xmir (XServerLocal *server, gboolean is_xmir);
89+
90 G_END_DECLS
91
92 #endif /* X_SERVER_LOCAL_H_ */

Subscribers

People subscribed via source and target branches