The start up script for Fluxbox (and possibly other WM) fails to initialise a users environment correctly and run the /etc/profile scripts. The X components that are not run / loaded are: ~/.xsession ~/.Xresources ~/.Xdefaults ~/.Xmodmap A proposed fix for this problem is to replce the existing /etc/X11/Session/fluxbox script with the following: [code] #!/bin/sh # Fluxbox start-up script, called from /etc/X11/chooser.sh (xdm/kdm) # Modified (completely rewritten) by Mark Gawler 12-May-2002 # Load .Xdefaults, .Xmodmap and run /etc/profile, ~/.xsession # For some reason /etc/profile was not run during the starting of fluxbox so # hear seems like a good place to add it. source /etc/profile # The start up of fluxbox seems to be sadly missing the running / loading of # the normal user definable stuff when the user logs in via xdm/kdm so we'll # do it hear. startup=$HOME/.xsession userdefaults=$HOME/.Xdefaults userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap #Xdefaults if [ -f "$userdefaults" ]; then xrdb -merge "$userdefaults" fi #Xresorces if [ -f "$userresources" ]; then xrdb -merge "$userresources" fi #Xmodmap if [ -f "$usermodmap" ]; then xmodmap "$usermodmap" fi #xsession if [ -f "$startup" ]; then if [ -x "$startup" ]; then source "$startup" & else source /bin/sh "$startup" & fi fi # And finally we'll start fluxbox, /usr/bin/fluxbox [/code]
to be honest, I do not think it is the window manager's job to do this. I think it is the user's job to do this. In other words, I'm not convinced that this is a correct thing to do, but I have an open enough mind to consider your argument, if you'd like to make one..
OK, wait, I see your point if it is something that applied to gdm, kdm and xdm rather than specific window managers.
Please read my comments, Mark.
I agree it is probably a gdm, kdm and xdm problem so I should have worded the bug differently. There is however a confusion in that the problem doesn't exist in KDE which, must do the initialisation for itself (I'm not saying that KDE is correct). I've re read the X and xdm man pages, these reinforce the view that it's a xdm problem: From the xdm man page - Overview "After the user logs in, xdm runs the Xstartup script as root. Then xdm runs the Xsession script as the user. This system session file may do some additional start-up and typically runs the .xsession script in the user's home directory." The Session Program section goes into more detail, which leads me to think that it's a problem with the /etc/X11/xdm/Xsession script rather than the fluxbox start-up script. KDE appears to do its own thing, which confused me. In conclusion there is a bug but its not specific to fluxbox.
sending this to Az since it's a DM issue
The idea was that each script for the window manager in /etc/X11/Sessions/ should setup the environment as needed for that specific WM. Gnome does this, as for KDE, etc, I have no idea. We can change /etc/X11/xdm/Xsession to load the resources in all cases if it will be easier.
Im putting this on my to-do for next X revision.
Ok, try xfree-4.2.0-r11.
Created attachment 1310 [details, diff] Fix to the fix in /etc/X11/Xsession That doesn't quite fix it, but its close :-) 1) The /etc/profile script still isn't run so the users PATH isn't set-up fully. 2) The ~/.xsession script needs to be run before the exec of the results of /etc/X11/chooser.sh, otherwise the ~/.xsession is not run. I've attached a patch to the Xfree 4.2.0-r11 /etc/X11/Xsession script Mark
To be honest, I dont think it should source /etc/profile. No other distro that I have looked at do this (was some time ago, so could be wrong) ... not even the generic files that comes with XFree86 do this. > 2) The ~/.xsession script needs to be run before the exec of the results of > /etc/X11/chooser.sh, otherwise the ~/.xsession is not run. This is debatible. But you may have part of the point. It should not always run ~/.xsession, but rather should do: ------------------------------snip------------------------------------ #xsession if [ -s "$startup" ]; then if [ -x "$startup" ]; then exec "$startup" else exec /bin/sh "$startup" fi elif [ -n "`/etc/X11/chooser.sh`" ]; then exec "`/etc/X11/chooser.sh`" else exec xsm fi ------------------------------snip----------------------------------- Meaning, it should execute ~/.xsession if it exists, else run the system default.
Actually, this is from the xdm manpage: -----------------------------snip--------------------------------- #!/bin/sh # # Xsession # # This is the program that is run as the client # for the display manager. case $# in 1) case $1 in failsafe) exec xterm -geometry 80x24-0-0 ;; esac esac startup=$HOME/.xsession resources=$HOME/.Xresources if [ -f "$startup" ]; then exec "$startup" else if [ -f "$resources" ]; then xrdb -load "$resources" fi twm & xman -geometry +10-10 & exec xterm -geometry 80x24+10+10 -ls fi -----------------------------snip--------------------------------- Which comes back to my original point that it is the session file in /etc/X11/Sessions that should do the proper setup, or the job of ~/.xsession. A good example (if you merge gnome-base/gdm) is the /etc/X11/Sessions/Gnome session file.
I was just re-reading the xdm manpage myself, I'd missed the point of how Xsession script was meant to work. Clearly you are quite correct about only one of the Xsession scripts being run, the users taking precedence. I was trying to use Xsession it a way it isn't meant to be. I was uneasy about the /etc/profile script being run in the Xsession script so again I think your correct, but who's responsibility is it? I thought it should be run prior to starting the WM so that the WM had the correct environment. The case that caused me to raise the bug in the first place was the Fluxbox menus. The default fluxbox menus have kde applications in (if kde in your USE flags), but the /etc/profile is not run during the starting of the WM so kde is not in the path and thus the applications cant be found. KDE manages to run the scrip during its start-up so is it a case that it's the responsibility of the individual WM.
I think this should go as a bug to fluxbox and co that do not have proper Session files ... maybe adding this bug as reference. Anyhow, ill fix the order in Xsession.
I only know how things stand with KDE. The x11/session script merely runs startkde, all the changes are made to startkde and the only relevant change is making it a login session (i.e. we modify it to start with #!/bin/sh --login). So it reads /etc/profile, which makes sense. If you make this a global feature, we'll need to remove it from there. I'm not clear as to the solution you decided on. Please tell me what if anything is required from the kde session script and/or kdm etc.
The changelog for xfree-4.2.0-r11 says: > Fix /etc/X11/xdm/Xsession to first run ~/.xsession, rather then the system > default (bug #2731). I have one gentoo system installed in August that uses -r12, which does as I would expect from this changelog. (possibly it used to use an older version and possibly CONFIG_PROTECT meant it didnt get updated, however I dont think this is the case). Its Xsession includes the fragment: ----snip # First run ~/.xsession if it exists if [ -s "$startup" ]; then if [ -x "$startup" ]; then exec "$startup" else exec /bin/sh "$startup" fi # If not, try the system default elif [ -n "`/etc/X11/chooser.sh`" ]; then exec "`/etc/X11/chooser.sh`" ----snip However the current -r12 ebuild in portage today includes the opposite. ----snip # First run the system default if [ -n "`/etc/X11/chooser.sh`" ]; then exec "`/etc/X11/chooser.sh`" # If not defined, try the user's ~/.xsession elif [ -s "$startup" ]; then if [ -x "$startup" ]; then exec "$startup" else exec /bin/sh "$startup" fi ----snip I think the first fragment is correct. Has something regressed in -r12 ?
It causes problems for KDE :(
The thing is that .xsession is supposed to start a window manager. This cannot work together with the possibility to choose ones windowmanager. I believe a new configuration file in that respect could be usefull. Esp. to start things like gpg-agent (needed for aegypten support in kde-3.1), or IME's. Basically each file in /etc/X11/Sessions could be changed to source in some script that loads what could be called the Xprofile. This script should be something like: #!/bin/sh if [ -f $HOME/.Xprofile ]; then source .Xprofile elif [ -f /etc/X11/Xprofile ]; then souce /etc/X11/Xprofile fi As example the kde start script would then be: #!/bin/sh source /etc/X11/loadprofile exec startkde