From 320eacba135418ed594f4bf56d1b800450684e32 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 30 Nov 2014 02:47:05 +0200 Subject: fix one 8 year long standing bug in xinit/startx --- x11-apps/xinit/Manifest | 1 + x11-apps/xinit/files/00-xhost | 7 ++ .../xinit/files/0001-Gentoo-customizations.patch | 61 ++++++++++++ x11-apps/xinit/files/Xsession | 107 +++++++++++++++++++++ x11-apps/xinit/files/Xsession.desktop | 8 ++ x11-apps/xinit/files/chooser.sh | 52 ++++++++++ x11-apps/xinit/files/startDM.sh | 31 ++++++ .../files/use_xauthority_as_xserverauthfile.patch | 12 +++ .../files/xinit-1.3.3-gentoo-customizations.patch | 61 ++++++++++++ x11-apps/xinit/files/xserverrc | 2 + x11-apps/xinit/files/xserverrc.1 | 6 ++ x11-apps/xinit/xinit-1.3.3.ebuild | 73 ++++++++++++++ 12 files changed, 421 insertions(+) create mode 100644 x11-apps/xinit/Manifest create mode 100644 x11-apps/xinit/files/00-xhost create mode 100644 x11-apps/xinit/files/0001-Gentoo-customizations.patch create mode 100755 x11-apps/xinit/files/Xsession create mode 100644 x11-apps/xinit/files/Xsession.desktop create mode 100755 x11-apps/xinit/files/chooser.sh create mode 100755 x11-apps/xinit/files/startDM.sh create mode 100644 x11-apps/xinit/files/use_xauthority_as_xserverauthfile.patch create mode 100644 x11-apps/xinit/files/xinit-1.3.3-gentoo-customizations.patch create mode 100755 x11-apps/xinit/files/xserverrc create mode 100644 x11-apps/xinit/files/xserverrc.1 create mode 100644 x11-apps/xinit/xinit-1.3.3.ebuild (limited to 'x11-apps/xinit') diff --git a/x11-apps/xinit/Manifest b/x11-apps/xinit/Manifest new file mode 100644 index 00000000..b3e639a0 --- /dev/null +++ b/x11-apps/xinit/Manifest @@ -0,0 +1 @@ +DIST xinit-1.3.3.tar.bz2 163905 SHA256 74b2878de6e3d5b5948f1562a77e7f53b4e10621e505ddb278050c7f3cae00af SHA512 345d9a00991e25df0a565f5b7edfbf504df9e019fc8ca2d31e4d2899e4765d7a18f0fffec0b4dda5eef99982cf8482925656a4e18576105f267393de51257d65 WHIRLPOOL 106656351391ff8de397394d56ea225f910f82be3cbacaf81c0735d2a259437632bd5428fc96900a0b88146fd11f8d8670f07f3dd2869b44ff6525c399b936f4 diff --git a/x11-apps/xinit/files/00-xhost b/x11-apps/xinit/files/00-xhost new file mode 100644 index 00000000..82cf1038 --- /dev/null +++ b/x11-apps/xinit/files/00-xhost @@ -0,0 +1,7 @@ +#!/bin/sh +# Allow all local connections from the current UID +# This fixes issues with hostname changes (usually by dhcp clients) +# see bug 287498 for more info + +[ -x /usr/bin/xhost ] && [ -x /usr/bin/id ] && + xhost +si:localuser:`id -un` > /dev/null 2>&1 diff --git a/x11-apps/xinit/files/0001-Gentoo-customizations.patch b/x11-apps/xinit/files/0001-Gentoo-customizations.patch new file mode 100644 index 00000000..a25ef4ba --- /dev/null +++ b/x11-apps/xinit/files/0001-Gentoo-customizations.patch @@ -0,0 +1,61 @@ +From d24cea5021fab8a11b1492a031319939d133d221 Mon Sep 17 00:00:00 2001 +From: Tomas Chvatal +Date: Mon, 1 Nov 2010 16:46:36 +0100 +Subject: [PATCH] Gentoo customizations. + + +Signed-off-by: Tomas Chvatal +--- + xinitrc.cpp | 26 ++++++++++++++++++-------- + 1 files changed, 18 insertions(+), 8 deletions(-) + +diff --git a/xinitrc.cpp b/xinitrc.cpp +index 049a8e4..80c3ad9 100644 +--- a/xinitrc.cpp ++++ b/xinitrc.cpp +@@ -2,8 +2,8 @@ XCOMM!SHELL_CMD + + userresources=$HOME/.Xresources + usermodmap=$HOME/.Xmodmap +-sysresources=XINITDIR/.Xresources +-sysmodmap=XINITDIR/.Xmodmap ++sysresources=XINITDIR/Xresources ++sysmodmap=XINITDIR/Xmodmap + + XCOMM merge in defaults and keymaps + +@@ -84,15 +84,25 @@ fi + XCOMM This is the fallback case if nothing else is executed above + #endif /* !defined(__SCO__) && !defined(__UNIXWARE__) */ + ++if [ -n "`/etc/X11/chooser.sh`" ]; then ++ command="`/etc/X11/chooser.sh`" ++else ++ failsafe="yes" ++fi ++ + if [ -d XINITDIR/xinitrc.d ] ; then +- for f in XINITDIR/xinitrc.dXSLASHGLOB.sh ; do ++ for f in XINITDIR/xinitrc.dXSLASHGLOB ; do + [ -x "$f" ] && . "$f" + done + unset f + fi + +-TWM & +-XCLOCK -geometry 50x50-1+1 & +-XTERM -geometry 80x50+494+51 & +-XTERM -geometry 80x20+494-0 & +-exec XTERM -geometry 80x66+0+0 -name login ++if [ -n "$failsafe" ]; then ++ TWM & ++ XCLOCK -geometry 50x50-1+1 & ++ XTERM -geometry 80x50+494+51 & ++ XTERM -geometry 80x20+494-0 & ++ exec XTERM -geometry 80x66+0+0 -name login ++else ++ exec $command ++fi +-- +1.7.3.1 + diff --git a/x11-apps/xinit/files/Xsession b/x11-apps/xinit/files/Xsession new file mode 100755 index 00000000..c86ccee1 --- /dev/null +++ b/x11-apps/xinit/files/Xsession @@ -0,0 +1,107 @@ +#!/bin/sh +# $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $ + +case $# in +1) + case $1 in + failsafe) + exec xterm -geometry 80x24-0-0 + ;; + esac +esac + +# redirect errors to a file in user's home directory if we can +for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER" +do + if ( cp /dev/null "$errfile" 2> /dev/null ) + then + chmod 600 "$errfile" + exec > "$errfile" 2>&1 + break + fi +done + +# clean up after xbanner +if which freetemp 2> /dev/null ; then + freetemp +fi + +startup=$HOME/.xsession + +userresources=$HOME/.Xresources +usermodmap=$HOME/.Xmodmap +userxkbmap=$HOME/.Xkbmap + +sysresources=/etc/X11/Xresources +sysmodmap=/etc/X11/Xmodmap +sysxkbmap=/etc/X11/Xkbmap + +rh6sysresources=/etc/X11/xinit/Xresources +rh6sysmodmap=/etc/X11/xinit/Xmodmap + + +# merge in defaults +if [ -f "$rh6sysresources" ]; then + xrdb -merge "$rh6sysresources" +fi + +if [ -f "$sysresources" ]; then + xrdb -merge "$sysresources" +fi + +if [ -f "$userresources" ]; then + xrdb -merge "$userresources" +fi + +# merge in keymaps +if [ -f "$sysxkbmap" ]; then + setxkbmap `cat "$sysxkbmap"` + XKB_IN_USE=yes +fi + +if [ -f "$userxkbmap" ]; then + setxkbmap `cat "$userxkbmap"` + XKB_IN_USE=yes +fi + +# +# Eeek, this seems like too much magic here +# +if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then + if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then + xkbsymbols=`sed -n -e 's/^[ ]*XkbSymbols[ ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config` + if [ -n "$xkbsymbols" ]; then + setxkbmap -symbols "$xkbsymbols" + XKB_IN_USE=yes + fi + fi +fi + +# xkb and xmodmap don't play nice together +if [ -z "$XKB_IN_USE" ]; then + if [ -f "$rh6sysmodmap" ]; then + xmodmap "$rh6sysmodmap" + fi + + if [ -f "$sysmodmap" ]; then + xmodmap "$sysmodmap" + fi + + if [ -f "$usermodmap" ]; then + xmodmap "$usermodmap" + fi +fi + +unset XKB_IN_USE + +if [ -x "$startup" ]; then + exec "$startup" +elif [ -x "$HOME/.Xclients" ]; then + exec "$HOME/.Xclients" +elif [ -x /etc/X11/xinit/Xclients ]; then + exec /etc/X11/xinit/Xclients +elif [ -x /etc/X11/Xclients ]; then + exec /etc/X11/Xclients +else + exec xsm +fi diff --git a/x11-apps/xinit/files/Xsession.desktop b/x11-apps/xinit/files/Xsession.desktop new file mode 100644 index 00000000..0c5adb9d --- /dev/null +++ b/x11-apps/xinit/files/Xsession.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=XSession +Comment=This session logs you into your custom Xsession +Exec=/etc/X11/Sessions/Xsession +TryExec=/etc/X11/Sessions/Xsession +# no icon yet, only the top three are currently used +Icon= +Type=Application diff --git a/x11-apps/xinit/files/chooser.sh b/x11-apps/xinit/files/chooser.sh new file mode 100755 index 00000000..f24be46d --- /dev/null +++ b/x11-apps/xinit/files/chooser.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 +# Author: Martin Schlemmer +# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/chooser.sh,v 1.5 2009/11/14 14:18:43 scarabeus Exp $ + +# Find a match for $XSESSION in /etc/X11/Sessions +GENTOO_SESSION="" +for x in /etc/X11/Sessions/* ; do + if [ "`echo ${x##*/} | awk '{ print toupper($1) }'`" \ + = "`echo ${XSESSION} | awk '{ print toupper($1) }'`" ]; then + GENTOO_SESSION=${x} + break + fi +done + +GENTOO_EXEC="" + +if [ -n "${XSESSION}" ]; then + if [ -f /etc/X11/Sessions/${XSESSION} ]; then + if [ -x /etc/X11/Sessions/${XSESSION} ]; then + GENTOO_EXEC="/etc/X11/Sessions/${XSESSION}" + else + GENTOO_EXEC="/bin/sh /etc/X11/Sessions/${XSESSION}" + fi + elif [ -n "${GENTOO_SESSION}" ]; then + if [ -x "${GENTOO_SESSION}" ]; then + GENTOO_EXEC="${GENTOO_SESSION}" + else + GENTOO_EXEC="/bin/sh ${GENTOO_SESSION}" + fi + else + x="" + y="" + + for x in "${XSESSION}" \ + "`echo ${XSESSION} | awk '{ print toupper($1) }'`" \ + "`echo ${XSESSION} | awk '{ print tolower($1) }'`" + do + # Fall through ... + if [ -x "`which ${x} 2>/dev/null`" ]; then + GENTOO_EXEC="`which ${x} 2>/dev/null`" + break + fi + done + fi +fi + +echo "${GENTOO_EXEC}" + + +# vim:ts=4 diff --git a/x11-apps/xinit/files/startDM.sh b/x11-apps/xinit/files/startDM.sh new file mode 100755 index 00000000..ebb79704 --- /dev/null +++ b/x11-apps/xinit/files/startDM.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 +# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/files/startDM.sh,v 1.5 2011/01/22 15:35:49 lxnay Exp $ + +# We need to source /etc/profile for stuff like $LANG to work +# bug #10190. +. /etc/profile + +. /etc/init.d/functions.sh + +# baselayout-1 compat +if ! type get_options >/dev/null 2>/dev/null ; then + [ -r "${svclib}"/sh/rc-services.sh ] && . "${svclib}"/sh/rc-services.sh +fi + +# Great new Gnome2 feature, AA +# We enable this by default +export GDK_USE_XFT=1 + +export SVCNAME=xdm +EXEC="$(get_options service)" +NAME="$(get_options name)" +PIDFILE="$(get_options pidfile)" +START_STOP_ARGS="$(get_options start_stop_args)" + +start-stop-daemon --start --exec ${EXEC} \ +${NAME:+--name} ${NAME} ${PIDFILE:+--pidfile} ${PIDFILE} ${START_STOP_ARGS} || \ +eerror "ERROR: could not start the Display Manager" + +# vim:ts=4 diff --git a/x11-apps/xinit/files/use_xauthority_as_xserverauthfile.patch b/x11-apps/xinit/files/use_xauthority_as_xserverauthfile.patch new file mode 100644 index 00000000..98a76909 --- /dev/null +++ b/x11-apps/xinit/files/use_xauthority_as_xserverauthfile.patch @@ -0,0 +1,12 @@ +diff -Nur a/startx.cpp b/startx.cpp +--- a/startx.cpp 2013-09-08 19:37:33.000000000 +0300 ++++ b/startx.cpp 2014-11-30 00:17:06.090007306 +0200 +@@ -287,7 +287,7 @@ + dummy=0 + + XCOMM create a file with auth information for the server. ':0' is a dummy. +- xserverauthfile=$HOME/.serverauth.$$ ++ xserverauthfile=$XAUTHORITY + trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM + xauth -q -f "$xserverauthfile" << EOF + add :$dummy . $mcookie diff --git a/x11-apps/xinit/files/xinit-1.3.3-gentoo-customizations.patch b/x11-apps/xinit/files/xinit-1.3.3-gentoo-customizations.patch new file mode 100644 index 00000000..48dceabc --- /dev/null +++ b/x11-apps/xinit/files/xinit-1.3.3-gentoo-customizations.patch @@ -0,0 +1,61 @@ +From d24cea5021fab8a11b1492a031319939d133d221 Mon Sep 17 00:00:00 2001 +From: Tomas Chvatal +Date: Mon, 1 Nov 2010 16:46:36 +0100 +Subject: [PATCH] Gentoo customizations. + + +Signed-off-by: Tomas Chvatal +--- + xinitrc.cpp | 26 ++++++++++++++++++-------- + 1 files changed, 18 insertions(+), 8 deletions(-) + +diff --git a/xinitrc.cpp b/xinitrc.cpp +index 049a8e4..80c3ad9 100644 +--- a/xinitrc.cpp ++++ b/xinitrc.cpp +@@ -2,8 +2,8 @@ XCOMM!SHELL_CMD + + userresources=$HOME/.Xresources + usermodmap=$HOME/.Xmodmap +-sysresources=XINITDIR/.Xresources +-sysmodmap=XINITDIR/.Xmodmap ++sysresources=XINITDIR/Xresources ++sysmodmap=XINITDIR/Xmodmap + + XCOMM merge in defaults and keymaps + +@@ -84,15 +84,25 @@ fi + XCOMM This is the fallback case if nothing else is executed above + #endif /* !defined(__SCO__) && !defined(__UNIXWARE__) */ + ++if [ -n "`/etc/X11/chooser.sh`" ]; then ++ command="`/etc/X11/chooser.sh`" ++else ++ failsafe="yes" ++fi ++ + if [ -d XINITDIR/xinitrc.d ] ; then +- for f in XINITDIR/xinitrc.d/?*.sh ; do ++ for f in XINITDIR/xinitrc.d/?* ; do + [ -x "$f" ] && . "$f" + done + unset f + fi + +-TWM & +-XCLOCK -geometry 50x50-1+1 & +-XTERM -geometry 80x50+494+51 & +-XTERM -geometry 80x20+494-0 & +-exec XTERM -geometry 80x66+0+0 -name login ++if [ -n "$failsafe" ]; then ++ TWM & ++ XCLOCK -geometry 50x50-1+1 & ++ XTERM -geometry 80x50+494+51 & ++ XTERM -geometry 80x20+494-0 & ++ exec XTERM -geometry 80x66+0+0 -name login ++else ++ exec $command ++fi +-- +1.7.3.1 + diff --git a/x11-apps/xinit/files/xserverrc b/x11-apps/xinit/files/xserverrc new file mode 100755 index 00000000..b4de2528 --- /dev/null +++ b/x11-apps/xinit/files/xserverrc @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/bin/X -nolisten tcp "$@" diff --git a/x11-apps/xinit/files/xserverrc.1 b/x11-apps/xinit/files/xserverrc.1 new file mode 100644 index 00000000..6b57eeba --- /dev/null +++ b/x11-apps/xinit/files/xserverrc.1 @@ -0,0 +1,6 @@ +#!/bin/sh +if [ -z "$XDG_VTNR" ]; then + exec /usr/bin/X -nolisten tcp "$@" +else + exec /usr/bin/X -nolisten tcp "$@" vt$XDG_VTNR +fi diff --git a/x11-apps/xinit/xinit-1.3.3.ebuild b/x11-apps/xinit/xinit-1.3.3.ebuild new file mode 100644 index 00000000..7f4c4726 --- /dev/null +++ b/x11-apps/xinit/xinit-1.3.3.ebuild @@ -0,0 +1,73 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-apps/xinit/xinit-1.3.3.ebuild,v 1.10 2013/10/08 05:03:50 ago Exp $ + +EAPI=5 + +inherit xorg-2 + +DESCRIPTION="X Window System initializer" + +LICENSE="${LICENSE} GPL-2" +KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~arm-linux ~x86-linux" +IUSE="+minimal" + +RDEPEND=" + ! /etc/env.d/90xsession" + ewarn " env-update && source /etc/profile" +} -- cgit v1.2.3