/etc/X11/chooser.sh is supposed to find the executable to run when starting X via startx. It is configured by the XSESSION environment variable. If it refers to a script found in /etc/X11/Sessions/, everything works as expected. If it refers to an executable in the caller's PATH, chooser.sh *incorrectly* chooses /usr/X11R6/bin/twm to be run. There is a trivial, but nasty bug. The following patch solves the problem; the "if everything else fails" path was executed every time! Reproducible: Always Steps to Reproduce: 1. run XSESSION=xterm startx Actual Results: /usr/X11R6/bin/twm is started. Expected Results: xterm should have benn started. See comments before XSESSION setting in /etc/rc.conf .
Created attachment 44857 [details, diff] Trivial patch that fixes the bug.
GENTOO_EXEC should stay to "" in case XSESSION is undefined, or else, this will brake xdm. And also there is no need to set GENTOO_EXEC to "/usr/X11R6/bin/twm" in case ${XSESSION} does not reside in path as /etc/X11/xinit/xinitrc will lunch the true default session: $ tail -n 12 /etc/X11/xinit/xinitrc # If not present, try the system default elif [ -n "`/etc/X11/chooser.sh`" ]; then exec "`/etc/X11/chooser.sh`" # Failsafe else # start some nice programs twm & xclock -geometry 50x50-1+1 & xterm -geometry 80x50+494+51 & xterm -geometry 80x20+494-0 & exec xterm -geometry 80x66+0+0 -name login fi So I attach what I think is a better patch. And also, in case XSESSION is pointing to trash, this will unblock the use of ~/.xsession in xdm: # tail -n 47 /etc/X11/xdm/Xsession | head -n 15 startup=$HOME/.xsession .... # First run the system default. Because KDE uses this # to switch sessions, we MUST first check the system # default, and then ~/.xsession. If the user Do not # want this, he should override XSESSION, or at least # clear it. if [ -n "`/etc/X11/chooser.sh`" ]; then exec "`/etc/X11/chooser.sh`" # If not defined, try the user's ~/.xsession elif [ -s "$startup" ]; then Yuri.
Created attachment 44968 [details, diff] fixed chooser.sh patch
Looks good. Can anyone apply the revised patch to gentoo CVS?
I need to look it over, but I haven't had time lately.
Could someone please test and report on the following scenarios, if you have a few minutes? 1. Using [xgk]dm 2. startx, an xsession set in XSESSION 3. startx, a binary set in XSESSION (both full path and just the binary name) 4. startx, nothing in XSESSION 5. startx with ~/.xinitrc, something set in XSESSION
This won't get applied until there are results for the above, so motivated people should do so.
Again reiterating comment #6.
Sorry about the delay, I didn't notice the previous comments. > 1. Using [xgk]dm Cannot test this one, I do not have any dm set up. Could you, please, test this one? > 2. startx, an xsession set in XSESSION $ XSESSION=Xsession startx Works, runs /etc/X11/Sessions/Xsession . > 3. startx, a binary set in XSESSION (both full path and just the > binary name) $ XSESSION=xterm startx Runs xterm . > 4. startx, nothing in XSESSION Runs XSESSION from /etc/rc.conf . > 5. startx with ~/.xinitrc, something set in XSESSION Ignores XSESSION, runs ~/.xinitrc . I hope that should do it :-) Bye for now. Rudo.
Created attachment 49336 [details, diff] better chooser.sh patch this one should resolve the bug. It is [xk]dm tested.
Bruno, how's that one better? It adds something redundantly that's already done in xinitrc, as comment #2 shows.
Waiting for an answer...
Reopening to fix
Fixed in x11-apps/xinit.