> > When trying to use a .xsession file, I discovered that the functionality > > doesn't work as it is documented. > > How so? I use .xsession files at home and at work, and they work for > me.
OK, I see why. The problem only happens in the 'program' session type. That's when the variable STARTUP is incorrectly overwritten with the full path of the given program. > > The core problem is on line 29 of 20xfree86-common_process-args, where > > the variable STARTUP is used to hold the program name of a non-default > > window manager. > > No, it's supposed to hold the name of any program that the display > manager passes to it. See "SESSION TYPES" in Xsession(5). > > > However, STARTUP is supposed to hold the string $HOME/.xsession. > > Not really, no. Especially not if $HOME/.Xsession is not executable. That's the confusion that caused this bug. See line 58 of Xsession: STARTUP=$HOME/.xsession And then line 4 of 50xfree86-common_determine-startup: for STARTUPFILE in "$STARTUP" "$ALTSTARTUP"; do > Could you please send this bug report a diff so that I can see what you > actually changed (then I can restore the "patch" tag)? I've attached two patches here. simple.patch just changes the three lines that enable allow-user-xsession to work with the 'program'-type session. morechanges.patch changes some variable names to avoid STARTUP and REALSTARTUP confusion. Now STARTUP holds the name of the program that will be executed. There are also two functional changes that I can back out if you want. One is to pass the program exactly as passed (and not expanding the full patch with `which $1`). The other is to export the STARTUPPROGRAM variable when a user is using an .xsession file so that the 'program' selected in the DM can be used in the .xsession. Perhaps the names of 20xfree86-common_process-args and 50xfree86-common_determine-startup should be changed to 20xfree86-common_determine-startup and 50xfree86-common_user-xsession because that is what is happening in them. If you want, I could write up changes to the doc, too, though I'm not sure about diffing a manpage. :) > I think it's possible you have changed the conffiles on the system such > that user sessions are not allowed without further modifications to the > scripts. I think that this bug only manifests itself with GDM and KDM when a specific, non-default startup program is picked. Because you're the XDM maintainer, I imagine you use that, so don't see the problem. Let me know if you need anything more. Frank
diff -r X11/Xsession.d/20xfree86-common_process-args X11.simple/Xsession.d/20xfree86-common_process-args 29c29 < STARTUP=$PROGRAM --- > REALSTARTUP=$PROGRAM diff -r X11/Xsession.d/50xfree86-common_determine-startup X11.simple/Xsession.d/50xfree86-common_determine-startup 1,2d0 < REALSTARTUP= <
diff -r X11/Xsession X11.morechanges/Xsession 58,59c58,59 < STARTUP=$HOME/.xsession < ALTSTARTUP=$HOME/.Xsession --- > USERXSESSION=$HOME/.xsession > USERALTXSESSION=$HOME/.Xsession diff -r X11/Xsession.d/20xfree86-common_process-args X11.morechanges/Xsession.d/20xfree86-common_process-args 0a1,11 > > set_default_startup () { > if [ -x /usr/bin/x-session-manager ]; then > STARTUP=x-session-manager > elif [ -x /usr/bin/x-window-manager ]; then > STARTUP=x-window-manager > elif [ -x /usr/bin/x-terminal-emulator ]; then > STARTUP=x-terminal-emulator > fi > } > 2a14 > set_default_startup 23a36 > set_default_startup 26,29c39,42 < PROGRAM=$(which $1) < if [ -n "$PROGRAM" -a -e "$PROGRAM" ]; then < if [ -x "$PROGRAM" ]; then < STARTUP=$PROGRAM --- > FULLPATHSTARTUP=$(which $1) > if [ -n "$FULLPATHSTARTUP" -a -e "$FULLPATHSTARTUP" ]; then > if [ -x "$FULLPATHSTARTUP" ]; then > STARTUP="$1" diff -r X11/Xsession.d/50xfree86-common_determine-startup X11.morechanges/Xsession.d/50xfree86-common_determine-startup 1,2d0 < REALSTARTUP= < 4,7c2,9 < for STARTUPFILE in "$STARTUP" "$ALTSTARTUP"; do < if [ -e "$STARTUPFILE" ]; then < if [ -x "$STARTUPFILE" ]; then < REALSTARTUP=$STARTUPFILE --- > for XSESSIONFILE in "$USERXSESSION" "$USERALTXSESSION"; do > if [ -e "$XSESSIONFILE" ]; then > # Allow .xsession to know the selected session with this variable > STARTUPPROGRAM="$STARTUP" > export STARTUPPROGRAM > > if [ -x "$XSESSIONFILE" ]; then > STARTUP="$XSESSIONFILE" 9c11 < REALSTARTUP="sh $STARTUPFILE" --- > STARTUP="sh $XSESSIONFILE" 16,26c18 < if [ -z "$REALSTARTUP" ]; then < if [ -x /usr/bin/x-session-manager ]; then < REALSTARTUP=x-session-manager < elif [ -x /usr/bin/x-window-manager ]; then < REALSTARTUP=x-window-manager < elif [ -x /usr/bin/x-terminal-emulator ]; then < REALSTARTUP=x-terminal-emulator < fi < fi < < if [ -z "$REALSTARTUP" ]; then --- > if [ -z "$STARTUP" ]; then diff -r X11/Xsession.d/90xfree86-common_ssh-agent X11.morechanges/Xsession.d/90xfree86-common_ssh-agent 16c16 < REALSTARTUP="$SSHAGENT $SSHAGENTARGS $REALSTARTUP" --- > STARTUP="$SSHAGENT $SSHAGENTARGS $STARTUP" diff -r X11/Xsession.d/99xfree86-common_start X11.morechanges/Xsession.d/99xfree86-common_start 1c1 < exec $REALSTARTUP --- > exec $STARTUP