Gentoo Archives: gentoo-commits

From: "Gilles Dartiguelongue (eva)" <eva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in gnome-base/gdm/files: gdm-3.6.0-fix-daemonize-regression.patch gdm-3.6.0-selinux-automagic.patch gdm-2.32.0-broken-VT-detection.patch
Date: Wed, 26 Dec 2012 21:45:12
Message-Id: 20121226214501.A366A2171D@flycatcher.gentoo.org
1 eva 12/12/26 21:45:01
2
3 Added: gdm-3.6.0-fix-daemonize-regression.patch
4 gdm-3.6.0-selinux-automagic.patch
5 Removed: gdm-2.32.0-broken-VT-detection.patch
6 Log:
7 Version bump for Gnome 3.6. USE=introspection is now global. Clean up old revisions.
8
9 (Portage version: 2.2.0_alpha149/cvs/Linux x86_64, signed Manifest commit with key C6085806)
10
11 Revision Changes Path
12 1.1 gnome-base/gdm/files/gdm-3.6.0-fix-daemonize-regression.patch
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/gnome-base/gdm/files/gdm-3.6.0-fix-daemonize-regression.patch?rev=1.1&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/gnome-base/gdm/files/gdm-3.6.0-fix-daemonize-regression.patch?rev=1.1&content-type=text/plain
16
17 Index: gdm-3.6.0-fix-daemonize-regression.patch
18 ===================================================================
19 From 722d31dc8823090b651b103f0194b6380f2d458e Mon Sep 17 00:00:00 2001
20 From: Alexandre Rostovtsev <tetromino@g.o>
21 Date: Tue, 25 Sep 2012 22:30:29 -0400
22 Subject: [PATCH] daemonize so that the boot process can continue
23
24 Gentoo bug: #236701
25
26 Based on original patch by Dan Nicholson <dbn.lists@×××××.com> and
27 Gilles Dartiguelongue <eva@g.o>.
28
29 Fork gdm-binary, except when -nodaemon is used
30
31 Makes the gdm main binary fork and daemonize unless the -nodaemon or
32 --nodaemon options are used. Provides compatibility with xdm. Fixes
33 bug #550170.
34
35 In daemonized mode, start a new process group, and kill it in our signal
36 handlers, so that killing gdm kills its spawned processes, and so that
37 "/etc/init.d/xdm stop" actually works.
38 ---
39 configure.ac | 4 ++++
40 daemon/Makefile.am | 1 +
41 daemon/main.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
42 3 files changed, 65 insertions(+)
43
44 diff --git a/configure.ac b/configure.ac
45 index 61a43d6..a851ba5 100644
46 --- a/configure.ac
47 +++ b/configure.ac
48 @@ -99,6 +99,10 @@ PKG_CHECK_MODULES(DAEMON,
49 AC_SUBST(DAEMON_CFLAGS)
50 AC_SUBST(DAEMON_LIBS)
51
52 +PKG_CHECK_MODULES(LIBDAEMON, libdaemon)
53 +AC_SUBST(LIBDAEMON_CFLAGS)
54 +AC_SUBST(LIBDAEMON_LIBS)
55 +
56 GLIB_GSETTINGS
57
58 PKG_CHECK_MODULES(NSS,
59 diff --git a/daemon/Makefile.am b/daemon/Makefile.am
60 index bb84765..cf89b47 100644
61 --- a/daemon/Makefile.am
62 +++ b/daemon/Makefile.am
63 @@ -380,6 +380,7 @@ gdm_binary_LDADD = \
64 $(top_builddir)/common/libgdmcommon.la \
65 $(XLIB_LIBS) \
66 $(DAEMON_LIBS) \
67 + $(LIBDAEMON_LIBS) \
68 $(XDMCP_LIBS) \
69 $(LIBWRAP_LIBS) \
70 $(SYSTEMD_LIBS) \
71 diff --git a/daemon/main.c b/daemon/main.c
72 index 3b8572c..c2fe4fe 100644
73 --- a/daemon/main.c
74 +++ b/daemon/main.c
75 @@ -34,6 +34,8 @@
76 #include <locale.h>
77 #include <signal.h>
78
79 +#include <libdaemon/dfork.h>
80 +
81 #include <glib.h>
82 #include <glib/gi18n.h>
83 #include <glib/gstdio.h>
84 @@ -336,16 +338,26 @@ signal_cb (int signo,
85 gpointer data)
86 {
87 int ret;
88 + static gboolean ignore_signals = FALSE;
89
90 g_debug ("Got callback for signal %d", signo);
91
92 ret = TRUE;
93
94 + /* don't commit suicide before killing everyone in our process group */
95 + if (ignore_signals)
96 + return ret;
97 +
98 switch (signo) {
99 case SIGFPE:
100 case SIGPIPE:
101 /* let the fatal signals interrupt us */
102 g_debug ("Caught signal %d, shutting down abnormally.", signo);
103 + /* if we daemonized, kill all the processes we spawned */
104 + ignore_signals = TRUE;
105 + kill (-getpid (), signo);
106 + ignore_signals = FALSE;
107 +
108 ret = FALSE;
109
110 break;
111 @@ -354,6 +366,11 @@ signal_cb (int signo,
112 case SIGTERM:
113 /* let the fatal signals interrupt us */
114 g_debug ("Caught signal %d, shutting down normally.", signo);
115 + /* if we daemonized, kill all the processes we spawned */
116 + ignore_signals = TRUE;
117 + kill (-getpid (), signo);
118 + ignore_signals = FALSE;
119 +
120 ret = FALSE;
121
122 break;
123 @@ -418,13 +435,16 @@ main (int argc,
124 GOptionContext *context;
125 GError *error;
126 int ret;
127 + int i;
128 gboolean res;
129 GdmSignalHandler *signal_handler;
130 static gboolean do_timed_exit = FALSE;
131 static gboolean print_version = FALSE;
132 static gboolean fatal_warnings = FALSE;
133 + static gboolean no_daemon = FALSE;
134 static GOptionEntry entries [] = {
135 { "fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &fatal_warnings, N_("Make all warnings fatal"), NULL },
136 + { "nodaemon", 0, 0, G_OPTION_ARG_NONE, &no_daemon, N_("Do not fork into the background"), NULL },
137 { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)"), NULL },
138 { "version", 0, 0, G_OPTION_ARG_NONE, &print_version, N_("Print GDM version"), NULL },
139
140 @@ -439,6 +459,14 @@ main (int argc,
141
142 g_type_init ();
143
144 + /* preprocess the arguments to support the xdm style
145 + * -nodaemon option
146 + */
147 + for (i = 0; i < argc; i++) {
148 + if (strcmp (argv[i], "-nodaemon") == 0)
149 + argv[i] = "--nodaemon";
150 + }
151 +
152 context = g_option_context_new (_("GNOME Display Manager"));
153 g_option_context_add_main_entries (context, entries, NULL);
154 g_option_context_set_ignore_unknown_options (context, TRUE);
155 @@ -465,6 +493,33 @@ main (int argc,
156 g_log_set_always_fatal (fatal_mask);
157 }
158
159 + if (!no_daemon) {
160 + pid_t pid;
161 + if (daemon_retval_init () < 0) {
162 + g_warning ("Failed to create pipe");
163 + exit (-1);
164 + }
165 + if ((pid = daemon_fork ()) < 0) {
166 + /* Fork failed */
167 + daemon_retval_done ();
168 + exit (1);
169 + } else if (pid) {
170 + /* Parent process: wait 20s for daemon_retval_send() in the daemon process */
171 + if ((ret = daemon_retval_wait (20)) < 0) {
172 + g_warning ("Timed out waiting for daemon process: %s", strerror(errno));
173 + exit (255);
174 + } else if (ret > 0) {
175 + g_warning ("Daemon process returned error code %d", ret);
176 + exit (ret);
177 + }
178 + exit (0);
179 + }
180 + /* Daemon process */
181 + daemon_close_all (-1);
182 + /* Start a new process group so that killing the daemon will kill the processes that it spawned */
183 + setsid ();
184 + }
185 +
186 gdm_log_init ();
187
188 settings = gdm_settings_new ();
189 @@ -519,6 +574,9 @@ main (int argc,
190 g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, main_loop);
191 }
192
193 + if (!no_daemon)
194 + daemon_retval_send (0);
195 +
196 g_main_loop_run (main_loop);
197
198 g_debug ("GDM finished, cleaning up...");
199 @@ -535,6 +593,8 @@ main (int argc,
200 ret = 0;
201
202 out:
203 + if (!no_daemon)
204 + daemon_retval_send (ret);
205
206 return ret;
207 }
208 --
209 1.7.12
210
211
212
213
214 1.1 gnome-base/gdm/files/gdm-3.6.0-selinux-automagic.patch
215
216 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/gnome-base/gdm/files/gdm-3.6.0-selinux-automagic.patch?rev=1.1&view=markup
217 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/gnome-base/gdm/files/gdm-3.6.0-selinux-automagic.patch?rev=1.1&content-type=text/plain
218
219 Index: gdm-3.6.0-selinux-automagic.patch
220 ===================================================================
221 From 8f9bf7b053fc7a6c2e5b33fc43c168ba7250cb98 Mon Sep 17 00:00:00 2001
222 From: Alexandre Rostovtsev <tetromino@g.o>
223 Date: Tue, 25 Sep 2012 17:38:37 -0400
224 Subject: [PATCH] configure: Make selinux check non-automagic
225
226 ---
227 configure.ac | 6 +++++-
228 1 file changed, 5 insertions(+), 1 deletion(-)
229
230 diff --git a/configure.ac b/configure.ac
231 index 80a1fd4..61a43d6 100644
232 --- a/configure.ac
233 +++ b/configure.ac
234 @@ -142,9 +142,13 @@ AC_SUBST(UPOWER)
235 AC_SUBST(UPOWER_CFLAGS)
236 AC_SUBST(UPOWER_LIBS)
237
238 +AC_ARG_WITH(selinux,
239 + AS_HELP_STRING([--with-selinux],
240 + [Add SELinux support]))
241 +
242 PKG_CHECK_MODULES(LIBSELINUX, libselinux, have_selinux=yes, have_selinux=no)
243
244 -if test "x$have_selinux" = "xyes" ; then
245 +if test "x$have_selinux" = "xyes" && test "x$with_selinux" != "xno" ; then
246 AC_DEFINE(HAVE_SELINUX, 1, [Define if have selinux])
247 fi
248 AC_SUBST(LIBSELINUX_CFLAGS)
249 --
250 1.7.12