Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 72707 - chooser.sh (from xorg-x11-6.8.0-r3) selects twm even when XSESSION is valid
Summary: chooser.sh (from xorg-x11-6.8.0-r3) selects twm even when XSESSION is valid
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords: Inclusion
Depends on:
Blocks:
 
Reported: 2004-11-28 04:39 UTC by Rudo Thomas
Modified: 2006-03-22 23:56 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Trivial patch that fixes the bug. (chooser.sh.patch,362 bytes, patch)
2004-11-28 04:40 UTC, Rudo Thomas
Details | Diff
fixed chooser.sh patch (chooser.sh.patch,241 bytes, patch)
2004-11-29 18:34 UTC, Yuri Vasilevski (RETIRED)
Details | Diff
better chooser.sh patch (chooser.diff,292 bytes, patch)
2005-01-23 17:13 UTC, Bruno Redondi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rudo Thomas 2004-11-28 04:39:20 UTC
/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 .
Comment 1 Rudo Thomas 2004-11-28 04:40:38 UTC
Created attachment 44857 [details, diff]
Trivial patch that fixes the bug.
Comment 2 Yuri Vasilevski (RETIRED) gentoo-dev 2004-11-29 18:32:22 UTC
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.
Comment 3 Yuri Vasilevski (RETIRED) gentoo-dev 2004-11-29 18:34:33 UTC
Created attachment 44968 [details, diff]
fixed chooser.sh patch
Comment 4 Rudo Thomas 2004-12-12 05:47:01 UTC
Looks good.

Can anyone apply the revised patch to gentoo CVS?
Comment 5 Donnie Berkholz (RETIRED) gentoo-dev 2004-12-12 12:42:45 UTC
I need to look it over, but I haven't had time lately.
Comment 6 Donnie Berkholz (RETIRED) gentoo-dev 2004-12-13 23:29:57 UTC
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
Comment 7 Donnie Berkholz (RETIRED) gentoo-dev 2004-12-22 11:14:58 UTC
This won't get applied until there are results for the above, so motivated people should do so.
Comment 8 Donnie Berkholz (RETIRED) gentoo-dev 2005-01-19 22:17:21 UTC
Again reiterating comment #6.
Comment 9 Rudo Thomas 2005-01-20 03:12:39 UTC
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.
Comment 10 Bruno Redondi 2005-01-23 17:13:37 UTC
Created attachment 49336 [details, diff]
better chooser.sh patch

this one should resolve the bug.
It is [xk]dm tested.
Comment 11 Donnie Berkholz (RETIRED) gentoo-dev 2005-01-23 19:25:17 UTC
Bruno, how's that one better? It adds something redundantly that's already done in xinitrc, as comment #2 shows.
Comment 12 Donnie Berkholz (RETIRED) gentoo-dev 2005-02-02 23:23:01 UTC
Waiting for an answer...
Comment 13 Donnie Berkholz (RETIRED) gentoo-dev 2006-03-22 23:56:46 UTC
Reopening to fix
Comment 14 Donnie Berkholz (RETIRED) gentoo-dev 2006-03-22 23:56:59 UTC
Fixed in x11-apps/xinit.