Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 301051 - x11-apps/xinit: /etc/X11/Sessions/Xsession ignores session passed by login managers
Summary: x11-apps/xinit: /etc/X11/Sessions/Xsession ignores session passed by login ma...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 2 votes (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords: PATCH
Depends on: 412003
Blocks: 746227
  Show dependency tree
 
Reported: 2010-01-15 04:30 UTC by William Keaney
Modified: 2022-01-26 18:05 UTC (History)
6 users (show)

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


Attachments
Xsession from KDM (Xsession,1.99 KB, text/plain)
2010-01-15 04:31 UTC, William Keaney
Details
Patched gentoo's Xsession (Xsession,2.21 KB, text/plain)
2010-01-21 16:02 UTC, P Purkayastha
Details
Add use of chooser.sh script to manage arguments passed to it (xsession.patch,846 bytes, patch)
2020-12-08 13:21 UTC, Roberto Castagnola
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description William Keaney 2010-01-15 04:30:19 UTC
The /etc/X11/Sessions/Xsession distributed with x11-apps/xinit completely ignores any session passed to it other than 'failsafe':

case $# in
1)
        case $1 in
        failsafe)
                exec xterm -geometry 80x24-0-0
                ;;
        esac
esac

This results in failure to start a session selected by a login manager, and instead considers only entries in $HOME/.Xclients and /etc/X11/xinit/Xclients (which doesn't exist).

Reproducible: Always
Comment 1 William Keaney 2010-01-15 04:31:30 UTC
Created attachment 216569 [details]
Xsession from KDM

I am attaching the Xsession file used by KDM, which correctly checks for the session passed by the login manager.
Comment 2 William Keaney 2010-01-15 04:35:06 UTC
I should note that I am running x11-apps/xinit-1.0.8-r10
Comment 3 P Purkayastha 2010-01-21 16:02:15 UTC
Created attachment 217090 [details]
Patched gentoo's Xsession

Alternatively, one can patch gentoo's Xsession file to handle sessions in /usr/share/xsessions. The file is attached. Following are the changes I made:

/etc/X11> diff -u Sessions/Xsession Xsession 
--- Sessions/Xsession	2009-12-24 15:23:37.000000000 -0500
+++ Xsession	2010-01-15 10:16:32.766354105 -0500
@@ -7,6 +7,7 @@
 	failsafe)
 		exec xterm -geometry 80x24-0-0
 		;;
+    *)  session="$1";;
 	esac
 esac
 
@@ -94,7 +95,9 @@
 
 unset XKB_IN_USE
 
-if [ -x "$startup" ]; then
+if [ -f "$session" ]; then
+    eval exec "$session"
+elif [ -x "$startup" ]; then
 	exec "$startup"
 elif [ -x "$HOME/.Xclients" ]; then
 	exec "$HOME/.Xclients"
Comment 4 Doktor Notor 2010-03-22 00:18:19 UTC
(In reply to comment #3)
> Alternatively, one can patch gentoo's Xsession file to handle sessions in
> /usr/share/xsessions.

Probably missing something here, but I don't see how this 

if [ -f "$session" ]; then
    eval exec "$session"

handles stuff in /usr/share/xsessions; the only thing it produces here it trying to exec $session as a command directly (which naturally fails)
Comment 5 P Purkayastha 2011-05-01 17:41:50 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Alternatively, one can patch gentoo's Xsession file to handle sessions in
> > /usr/share/xsessions.
> 
> Probably missing something here, but I don't see how this 
> 
> if [ -f "$session" ]; then
>     eval exec "$session"
> 
> handles stuff in /usr/share/xsessions; the only thing it produces here it
> trying to exec $session as a command directly (which naturally fails)

It seems I was not in the CC list and never got any notification.

This line is taken directly from the kdmrc file. It used to work earlier and going by the kdmrc file (see the one attached in this bug report) kdm itself runs something like that. I am not sure if it still works since I am using slim nowadays (and the configuration for that is different).
Comment 6 Matt Turner gentoo-dev 2019-03-03 23:17:10 UTC
Suggestions welcome (patches).
Comment 7 Matt Turner gentoo-dev 2019-05-15 18:12:30 UTC
This bug is pretty ancient at this point, and I'm not sure I understand it.

If someone is still interested, please reopen.
Comment 8 Roberto Castagnola 2020-12-07 17:37:23 UTC
I would like to reopen this bug since solving it would be usefull for tigervnc package (bug #746227), but I cannot figure how to do.
Could someone reopen it or shall I open a new one?
Comment 9 Matt Turner gentoo-dev 2020-12-07 17:42:11 UTC
(In reply to Roberto Castagnola from comment #8)
> I would like to reopen this bug since solving it would be usefull for
> tigervnc package (bug #746227), but I cannot figure how to do.
> Could someone reopen it or shall I open a new one?

Reopened. Please provide a patch that resolves the bug for you.
Comment 10 Roberto Castagnola 2020-12-08 13:21:53 UTC
Created attachment 677239 [details, diff]
Add use of chooser.sh script to manage arguments passed to it

Signed-off-by: Roberto Castagnola <roberto.castagnola@gmail.com>

It depends on bug #412003
It also takes care of xinitrc.d scripts (as done by Xsession scripts provided by other display managers, such as sddm)
Comment 11 Roberto Castagnola 2020-12-08 13:37:06 UTC
Xsession script look like more a wrapper script than a session script, so I wonder if it should be moved elsewhere (for example in /etc/X11/xinit as other linux distribution).
Further, if my patch provided for bug #412003 is accepted, I wonder if we can drop the use of folder /etc/X11/Sessions in favour of more standard folder /usr/share/xsessions. Looking to gentoo ebuilds I have seen that almost all of them are already providing both .desktop (in /usr/share/xsessions/) and script (in /etc/X11/Sessions/) files.
Comment 12 Joakim Tjernlund 2021-06-04 14:17:23 UTC
This look like a good effort to make VNC server sessions work properly.
Nice it it could acted upon
Comment 13 Alexander Wessel 2021-12-07 22:24:35 UTC
(In reply to Joakim Tjernlund from comment #12)
> This look like a good effort to make VNC server sessions work properly.
> Nice it it could acted upon

Indeed. Did you put a vote in?
Comment 14 Joakim Tjernlund 2021-12-07 22:36:31 UTC
(In reply to Alexander Wessel from comment #13)
> (In reply to Joakim Tjernlund from comment #12)
> > This look like a good effort to make VNC server sessions work properly.
> > Nice it it could acted upon
> 
> Indeed. Did you put a vote in?

I voted with my feet and fixed tigervnc upstream to build its xorg module against latest xorg-server a little while ago.