From 7500efbebed46f35b03394f679a01624308e040d Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 25 Mar 2014 13:00:18 +0100 Subject: [PATCH] Fix startx ignoring a server or display passed on the cmdline (#960955) - Drop Fedora custom patch to unset XDG_SESSION_COOKIE, this was only for CK --- ...p-RAWCPPFLAGS-when-generating-startx.patch | 26 ++++++++++ ...nder-Linux-start-X-on-the-current-VT.patch | 50 +++++++++++++++++++ ...ile.am-Give-XINITDIR-a-default-value.patch | 28 +++++++++++ xinit-1.0.9-unset.patch | 12 ----- xorg-x11-xinit-1.3.2-systemd-logind.patch | 27 ---------- xorg-x11-xinit.spec | 30 +++++------ 6 files changed, 120 insertions(+), 53 deletions(-) create mode 100644 0001-Drop-RAWCPPFLAGS-when-generating-startx.patch create mode 100644 0002-startx-Under-Linux-start-X-on-the-current-VT.patch create mode 100644 0003-Makefile.am-Give-XINITDIR-a-default-value.patch delete mode 100644 xinit-1.0.9-unset.patch delete mode 100644 xorg-x11-xinit-1.3.2-systemd-logind.patch diff --git a/0001-Drop-RAWCPPFLAGS-when-generating-startx.patch b/0001-Drop-RAWCPPFLAGS-when-generating-startx.patch new file mode 100644 index 0000000..114161c --- /dev/null +++ b/0001-Drop-RAWCPPFLAGS-when-generating-startx.patch @@ -0,0 +1,26 @@ +From 90b6f5dfcb9c9f41dcbd59b006ea703f2f78b3b1 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 25 Mar 2014 11:48:58 +0100 +Subject: [PATCH 1/3] Drop $RAWCPPFLAGS when generating startx + +startx.cpp contains things like #if defined(__SCO__), and +$RAWCPPFLAGS contains -undef causing these to not get set. + +Signed-off-by: Hans de Goede +--- + cpprules.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cpprules.in b/cpprules.in +index 0931bee..781676a 100644 +--- a/cpprules.in ++++ b/cpprules.in +@@ -15,4 +15,4 @@ CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ + SUFFIXES = .cpp + + .cpp: +- $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ ++ $(AM_V_GEN)$(RAWCPP) $(CPP_FILES_FLAGS) $< | $(CPP_SED_MAGIC) > $@ +-- +1.9.0 + diff --git a/0002-startx-Under-Linux-start-X-on-the-current-VT.patch b/0002-startx-Under-Linux-start-X-on-the-current-VT.patch new file mode 100644 index 0000000..3c66b1d --- /dev/null +++ b/0002-startx-Under-Linux-start-X-on-the-current-VT.patch @@ -0,0 +1,50 @@ +From e222d3b978499d1e9293dcbe97bb8349da8ad4ea Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 25 Mar 2014 11:54:31 +0100 +Subject: [PATCH 2/3] startx: Under Linux start X on the current VT + +When we let X allocate a new VT, systemd-logind will not recognize any +processes running on this VT as belonging to a valid session (since there +was no pam session opened on that tty). + +This causes problems like PolicyKit denials for these processes. + +ConsoleKit under Linux has been deprecated for a few years now and is no +longer being maintained, so simply make this the default under Linux. + +Note we do not pass in the vt if the user has specified an alternative server +to start, as the vtX argument is only valid for the Xorg server, likewise we +omit it if the user has specified any other server arguments. + +Fixes: +https://bugzilla.redhat.com/show_bug.cgi?id=806491 + +Signed-off-by: Hans de Goede +--- + startx.cpp | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/startx.cpp b/startx.cpp +index c595b84..3708471 100644 +--- a/startx.cpp ++++ b/startx.cpp +@@ -228,6 +228,16 @@ XCOMM process server arguments + if [ x"$server" = x ]; then + server=$defaultserver + ++#ifdef __linux__ ++ XCOMM When starting the defaultserver start X on the current tty to avoid ++ XCOMM the startx session being seen as inactive: RHBZ#820675 ++ tty=$(tty) ++ if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then ++ tty_num=$(echo "$tty" | grep -oE '[0-9]+$') ++ defaultserverargs=${defaultserverargs}" vt"${tty_num} ++ fi ++#endif ++ + XCOMM For compatibility reasons, only use xserverrc if there were no server command line arguments + if [ x"$serverargs" = x -a x"$display" = x ]; then + if [ -f "$userserverrc" ]; then +-- +1.9.0 + diff --git a/0003-Makefile.am-Give-XINITDIR-a-default-value.patch b/0003-Makefile.am-Give-XINITDIR-a-default-value.patch new file mode 100644 index 0000000..b787a32 --- /dev/null +++ b/0003-Makefile.am-Give-XINITDIR-a-default-value.patch @@ -0,0 +1,28 @@ +From ab3df9890d3056f217c1fce11101e362db1bdcf7 Mon Sep 17 00:00:00 2001 +From: Hans de Goede +Date: Tue, 25 Mar 2014 12:31:28 +0100 +Subject: [PATCH 3/3] Makefile.am: Give XINITDIR a default value + +We are using XINITDIR, but never setting it. Lets give it a sane default. + +Signed-off-by: Hans de Goede +--- + Makefile.am | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Makefile.am b/Makefile.am +index 3867bea..ec8d4cc 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -27,6 +27,8 @@ endif + bin_PROGRAMS = xinit + bin_SCRIPTS = startx + ++XINITDIR = $(sysconfdir)/X11/xinit ++ + AM_CFLAGS = $(CWARNFLAGS) $(XINIT_CFLAGS) + AM_CPPFLAGS = -DXINITDIR=\"$(XINITDIR)\" -DBINDIR=\"$(bindir)\" + xinit_LDADD = $(XINIT_LIBS) +-- +1.9.0 + diff --git a/xinit-1.0.9-unset.patch b/xinit-1.0.9-unset.patch deleted file mode 100644 index b8ae4ae..0000000 --- a/xinit-1.0.9-unset.patch +++ /dev/null @@ -1,12 +0,0 @@ -Index: xinit-1.3.1/startx.cpp -=================================================================== ---- xinit-1.3.1.orig/startx.cpp -+++ xinit-1.3.1/startx.cpp -@@ -11,6 +11,7 @@ XCOMM - XCOMM Site administrators are STRONGLY urged to write nicer versions. - XCOMM - -+unset XDG_SESSION_COOKIE - unset DBUS_SESSION_BUS_ADDRESS - unset SESSION_MANAGER - diff --git a/xorg-x11-xinit-1.3.2-systemd-logind.patch b/xorg-x11-xinit-1.3.2-systemd-logind.patch deleted file mode 100644 index 85261da..0000000 --- a/xorg-x11-xinit-1.3.2-systemd-logind.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff -Nur xinit-1.3.2.orig/startx.cpp xinit-1.3.2/startx.cpp ---- xinit-1.3.2.orig/startx.cpp 2012-09-29 11:55:06.661264745 -0600 -+++ xinit-1.3.2/startx.cpp 2012-09-29 11:56:24.849771316 -0600 -@@ -80,6 +80,7 @@ - defaultdisplay=":0" - clientargs="" - serverargs="" -+tty_num=$(tty | grep -oE '[0-9]+$') - - #ifdef __APPLE__ - -@@ -135,6 +136,15 @@ - enable_xauth=1 - #endif - -+if [ x"$tty_num" != x ]; then -+ # Specify TTY number directly to avoid recognizing startx session as -+ # inactive: RHBZ#820675 -+ serverargs=${serverargs}" vt"${tty_num} -+else -+ echo "Error getting tty num" -+ exit 1 -+fi -+ - XCOMM Automatically determine an unused $DISPLAY - d=0 - while true ; do diff --git a/xorg-x11-xinit.spec b/xorg-x11-xinit.spec index 2da6232..1493bca 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.2 -Release: 10%{?dist} +Release: 11%{?dist} License: MIT Group: User Interface/X URL: http://www.x.org @@ -24,10 +24,13 @@ Source19: xinit-compat # Fedora specific patches Patch1: xinit-1.0.2-client-session.patch -# Fix startx to run on the same tty as user to avoid new session. + +# Fixes scheduled to go upstream for the next release, fixing: # https://bugzilla.redhat.com/show_bug.cgi?id=806491 -Patch2: xorg-x11-xinit-1.3.2-systemd-logind.patch -Patch3: xinit-1.0.9-unset.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=960955 +Patch2: 0001-Drop-RAWCPPFLAGS-when-generating-startx.patch +Patch3: 0002-startx-Under-Linux-start-X-on-the-current-VT.patch +Patch4: 0003-Makefile.am-Give-XINITDIR-a-default-value.patch BuildRequires: pkgconfig BuildRequires: libX11-devel @@ -56,20 +59,17 @@ Allows legacy ~/.xsession and ~/.Xclients files to be used from display managers %prep %setup -q -n %{pkgname}-%{version} %patch1 -p1 -b .client-session -%patch2 -p1 -b .systemd-logind -%patch3 -p1 -b .unset +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build autoreconf -fi %configure -# FIXME: Upstream should default to XINITDIR being this. Make a patch to -# Makefile.am and submit it in a bug report or check into CVS. -make XINITDIR=%{_sysconfdir}/X11/xinit +make %{?_smp_mflags} %install -# FIXME: Upstream should default to XINITDIR being this. Make a patch to -# Makefile.am and submit it in a bug report or check into CVS. -make install DESTDIR=$RPM_BUILD_ROOT XINITDIR=%{_sysconfdir}/X11/xinit +%make_install install -p -m644 -D %{SOURCE18} $RPM_BUILD_ROOT%{_datadir}/xsessions/xinit-compat.desktop # Install Red Hat custom xinitrc, etc. @@ -95,7 +95,6 @@ install -p -m644 -D %{SOURCE18} $RPM_BUILD_ROOT%{_datadir}/xsessions/xinit-compa } %files -%defattr(-,root,root,-) %doc COPYING README ChangeLog %{_bindir}/startx %{_bindir}/xinit @@ -113,11 +112,14 @@ install -p -m644 -D %{SOURCE18} $RPM_BUILD_ROOT%{_datadir}/xsessions/xinit-compa %{_mandir}/man1/xinit.1* %files session -%defattr(-, root, root,-) %{_libexecdir}/xinit-compat %{_datadir}/xsessions/xinit-compat.desktop %changelog +* Tue Mar 25 2014 Hans de Goede - 1.3.2-11 +- Fix startx ignoring a server or display passed on the cmdline (#960955) +- Drop Fedora custom patch to unset XDG_SESSION_COOKIE, this was only for CK + * Thu Jan 23 2014 Dave Airlie 1.3.2-10 - fix for ppc64le enable (#1056742)