[xorg-x11-xinit] Fix startx auto display select not working when a Xserver started by

Hans de Goede jwrdegoede at fedoraproject.org
Fri Mar 20 14:02:06 UTC 2015


commit b5175fc98292f2c0cb64a0370494b27d836af4e3
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Fri Mar 20 15:02:04 2015 +0100

    Fix startx auto display select not working when a Xserver started by
    
      gdm is running

 ...startx-picking-an-already-used-display-nu.patch | 36 ++++++++++++++++++++++
 ...-startx-auto-display-select-work-with-per.patch | 35 +++++++++++++++++++++
 xorg-x11-xinit.spec                                | 14 +++++++--
 3 files changed, 82 insertions(+), 3 deletions(-)
---
diff --git a/0002-startx-Fix-startx-picking-an-already-used-display-nu.patch b/0002-startx-Fix-startx-picking-an-already-used-display-nu.patch
new file mode 100644
index 0000000..1db645a
--- /dev/null
+++ b/0002-startx-Fix-startx-picking-an-already-used-display-nu.patch
@@ -0,0 +1,36 @@
+From 848dc9b7f3a95f14efd4ea34188cba51965c9f53 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Fri, 20 Mar 2015 14:25:44 +0100
+Subject: [PATCH xinit 2/3] startx: Fix startx picking an already used display
+ number when -nolock is used
+
+Currently startx relies on /tmp/.X?-lock being present for automatically
+picking a free display number. This does not work if -nolock is used when
+starting the server, or if the server is started with -displayfd as -displayfd
+implies -nolock.
+
+This is becoming a problem now that -displayfd is getting used by
+display-managers (e.g. gdm), this fixes this by also checking for
+/tmp/.X11-unix/X?
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ startx.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/startx.cpp b/startx.cpp
+index 8520399..fe49996 100644
+--- a/startx.cpp
++++ b/startx.cpp
+@@ -120,7 +120,7 @@ enable_xauth=1
+ XCOMM Automatically determine an unused $DISPLAY
+ d=0
+ while true ; do
+-    [ -e /tmp/.X$d-lock ] || break
++    [ -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ] || break
+     d=$(($d + 1))
+ done
+ defaultdisplay=":$d"
+-- 
+2.3.3
+
diff --git a/0003-startx-Make-startx-auto-display-select-work-with-per.patch b/0003-startx-Make-startx-auto-display-select-work-with-per.patch
new file mode 100644
index 0000000..aa67ba0
--- /dev/null
+++ b/0003-startx-Make-startx-auto-display-select-work-with-per.patch
@@ -0,0 +1,35 @@
+From 72939fed64b00be4a74dd0e1bf0b418e00ac4c57 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Fri, 20 Mar 2015 14:30:08 +0100
+Subject: [PATCH xinit 3/3] startx: Make startx auto display select work with
+ per user /tmp dirs
+
+If a separate /tmp per user is used the existing auto display select code
+does not work, add an extra check for the unix socket for the display number
+existing in /proc/net/unix (linux only).
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ startx.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/startx.cpp b/startx.cpp
+index fe49996..3b0dd86 100644
+--- a/startx.cpp
++++ b/startx.cpp
+@@ -120,7 +120,11 @@ enable_xauth=1
+ XCOMM Automatically determine an unused $DISPLAY
+ d=0
+ while true ; do
+-    [ -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ] || break
++    [ -e "/tmp/.X$d-lock" -o -S "/tmp/.X11-unix/X$d" ] ||
++#ifdef __linux__
++        grep -q "/tmp/.X11-unix/X$d" "/proc/net/unix" ||
++#endif
++        break
+     d=$(($d + 1))
+ done
+ defaultdisplay=":$d"
+-- 
+2.3.3
+
diff --git a/xorg-x11-xinit.spec b/xorg-x11-xinit.spec
index a201d07..daf6acd 100644
--- a/xorg-x11-xinit.spec
+++ b/xorg-x11-xinit.spec
@@ -3,7 +3,7 @@
 Summary:    X.Org X11 X Window System xinit startup scripts
 Name:       xorg-x11-%{pkgname}
 Version:    1.3.4
-Release:    6%{?dist}
+Release:    7%{?dist}
 License:    MIT
 URL:        http://www.x.org
 
@@ -25,10 +25,12 @@ Patch1: xinit-1.0.2-client-session.patch
 # This is the Xserver default starting at xorg-x11-server >= 1.17, drop once
 # we've that version, rhbz#1111684
 Patch2: 0001-startx-Pass-nolisten-tcp-by-default.patch
-# submitted upstream, rhbz#1177513
+# A few fixes submitted upstream, rhbz#1177513, rhbz#1203780
 Patch3: 0001-startx-Pass-keeptty-when-telling-the-server-to-start.patch
+Patch4: 0002-startx-Fix-startx-picking-an-already-used-display-nu.patch
+Patch5: 0003-startx-Make-startx-auto-display-select-work-with-per.patch
 # Fedora specific patch to match the similar patch in the xserver
-Patch4: xinit-1.3.4-set-XORG_RUN_AS_USER_OK.patch
+Patch6: xinit-1.3.4-set-XORG_RUN_AS_USER_OK.patch
 
 BuildRequires:  pkgconfig(x11)
 BuildRequires:  dbus-devel
@@ -58,6 +60,8 @@ managers.
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
+%patch6 -p1
 
 %build
 %configure
@@ -111,6 +115,10 @@ install -p -m644 -D %{SOURCE18} $RPM_BUILD_ROOT%{_datadir}/xsessions/xinit-compa
 %{_datadir}/xsessions/xinit-compat.desktop
 
 %changelog
+* Fri Mar 20 2015 Hans de Goede <hdegoede at redhat.com> - 1.3.4-7
+- Fix startx auto display select not working when a Xserver started by
+  gdm is running
+
 * Wed Mar 18 2015 Hans de Goede <hdegoede at redhat.com> - 1.3.4-6
 - Set XORG_RUN_AS_USER_OK when starting X on the current tty, to run X
   to run without root rights when possible


More information about the scm-commits mailing list