summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-02-09 23:20:42 +0100
committerLudovic Courtès <ludo@gnu.org>2014-02-09 23:20:42 +0100
commitf9ec07a9859c5b305105ab38bff3f3db0dcb842d (patch)
treee9c726ae0dd2831cd16e8c548a04d6f05f1190d6
parent4cccb3617ee0e2344d0d986f3c60d97e77aa3249 (diff)
downloadguix-f9ec07a9859c5b305105ab38bff3f3db0dcb842d.tar.gz
gnu: slim: Work around flaky synchronization with the X server.
* gnu/packages/patches/slim-sigusr1.patch: New file.
* gnu/packages/slim.scm (slim): Use it.
* gnu-system.am (dist_patch_DATA): Add it.
-rw-r--r--gnu-system.am1
-rw-r--r--gnu/packages/patches/slim-sigusr1.patch33
-rw-r--r--gnu/packages/slim.scm3
3 files changed, 36 insertions, 1 deletions
diff --git a/gnu-system.am b/gnu-system.am
index cc34dbc7b3..a98ef250d0 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -299,6 +299,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/scheme48-tests.patch			\
   gnu/packages/patches/slim-session.patch			\
   gnu/packages/patches/slim-config.patch			\
+  gnu/packages/patches/slim-sigusr1.patch			\
   gnu/packages/patches/tcsh-fix-autotest.patch			\
   gnu/packages/patches/teckit-cstdio.patch			\
   gnu/packages/patches/valgrind-glibc.patch			\
diff --git a/gnu/packages/patches/slim-sigusr1.patch b/gnu/packages/patches/slim-sigusr1.patch
new file mode 100644
index 0000000000..344b02933e
--- /dev/null
+++ b/gnu/packages/patches/slim-sigusr1.patch
@@ -0,0 +1,33 @@
+This patch fixes SLiM so it really waits for the X server to be ready
+before attempting to connect to it.  Indeed, the X server notices that
+its parent process has a handler for SIGUSR1, and consequently sends it
+SIGUSR1 when it's ready to accept connections.
+
+The problem was that SLiM doesn't pay attention to SIGUSR1.  So in practice,
+if X starts slowly, then SLiM gets ECONNREFUSED a couple of time on
+/tmp/.X11-unix/X0, then goes on trying to connect to localhost:6000,
+where nobody answers; eventually, it times out and tries again on
+/tmp/.X11-unix/X0, and finally it shows up on the screen.
+
+Patch by L. Courtès.
+
+--- slim-1.3.6/app.cpp	2014-02-05 15:27:20.000000000 +0100
++++ slim-1.3.6/app.cpp	2014-02-09 22:42:04.000000000 +0100
+@@ -119,7 +119,9 @@ void CatchSignal(int sig) {
+ 	exit(ERR_EXIT);
+ }
+ 
++static volatile int got_sigusr1 = 0;
+ void User1Signal(int sig) {
++	got_sigusr1 = 1;
+ 	signal(sig, User1Signal);
+ }
+ 
+@@ -884,6 +886,7 @@ int App::WaitForServer() {
+ 	int	ncycles	 = 120;
+ 	int	cycles;
+ 
++	while (!got_sigusr1);
+ 	for(cycles = 0; cycles < ncycles; cycles++) {
+ 		if((Dpy = XOpenDisplay(DisplayName))) {
+ 			XSetIOErrorHandler(xioerror);
diff --git a/gnu/packages/slim.scm b/gnu/packages/slim.scm
index 1a1feadede..f25b070f3c 100644
--- a/gnu/packages/slim.scm
+++ b/gnu/packages/slim.scm
@@ -46,7 +46,8 @@
 	     (sha256
 	      (base32 "1pqhk22jb4aja4hkrm7rjgbgzjyh7i4zswdgf5nw862l2znzxpi1"))
              (patches (map search-patch
-                           (list "slim-config.patch" "slim-session.patch")))))
+                           (list "slim-config.patch" "slim-session.patch"
+                                 "slim-sigusr1.patch")))))
     (build-system cmake-build-system)
     (inputs `(("linux-pam" ,linux-pam)
 	      ("libpng" ,libpng)