FS#31204 - [libx11] overwrite XDG_CONFIG_HOME and friends
Attached to Project:
Arch Linux
Opened by Sébastien Luttringer (seblu) - Monday, 20 August 2012, 02:08 GMT
Last edited by Andreas Radke (AndyRTR) - Tuesday, 26 February 2013, 16:43 GMT
Opened by Sébastien Luttringer (seblu) - Monday, 20 August 2012, 02:08 GMT
Last edited by Andreas Radke (AndyRTR) - Tuesday, 26 February 2013, 16:43 GMT
|
Details
Description:
Files /etc/profile.d/xorg.* overwrite the following environment variables (more or less cleanly): XDG_DATA_HOME XDG_CONFIG_HOME XDG_CACHE_HOME XDG_DATA_DIRS XDG_CONFIG_DIRS These variables are overwritten each time a shell is spawned instead of be inherited from correct environment. The best way (i found) to define those variables is in ~/.pam_environment (read by pam_env). By example, if i want overwrite my XDG_DATA_HOME to ~/.data, i can put a line in ~/.pam_environment. These vars should be defined by users to override default locations defined in [1] and not defined to there default by a shell. I think we should drop these files. Or, at least, check if they already exists before overwrite. [1] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html |
This task depends upon
Closed by Andreas Radke (AndyRTR)
Tuesday, 26 February 2013, 16:43 GMT
Reason for closing: Fixed
Additional comments about closing: no more XDG predefinitions for now
Tuesday, 26 February 2013, 16:43 GMT
Reason for closing: Fixed
Additional comments about closing: no more XDG predefinitions for now
However, if we are going to overwrite the variables lets do the same for XDG_DATA_DIRS and XDG_CONFIG_DIRS.
Now it will add the same dir for every subshell, which is a bit ugly. This is how it looks for me:
% env | grep XDG.\*DIRS
XDG_CONFIG_DIRS=/etc/xdg:/etc/xdg:/etc/xdg
XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/local/share/:/usr/share/:/usr/local/share/:/usr/share/
When i was talking to some gnome people a while ago they were pretty surprised seeing those variables in my env.
Are they needed?
(Still, I agree with the removal – I had a chance to fix a few of my scripts.)
- liferea and gedit doesn't start: Trace/breakpoint trap (core dumped)
- opening a file in emacs : Trace/breakpoint trap (core dumped)
- icons in system tray are broken (deluge) or too small (quodlibet)
I'm using fvwm FWIW.
We need to decide if we bring the viriables back or leave it up to the users to menage it through the login process.
Opinions welcome.
Having said that, setting XDG variables on each login is a bad idea. For instance, I have libx11 as a dep on a server which has no Xorg. Why do I need these variables in my env?
If some programs break because of unset XDG vars, the best way to proceed is to copy-paste /etc/profile.d/xorg.sh in the beginning of your $HOME/.xinitrc.
> For instance, I have libx11 as a dep on a server which has no Xorg. Why do I need these variables in my env?
Because they are not specific to Xorg. For example, on my own machine, XDG_CONFIG_HOME is used by: burp, cower, git, htop, newsbeuter, obnam, pulseaudio, ranger, systemd, transmission-daemon – none of which depend on Xorg.
I don't think systemd should care about settings involving $HOME. Git probably needs XDG variables for the per-user gui settings (which I've never used)...
> Just to be clear, we are talking about per-user XDG settings, not system-wide...
Right.
> I don't think systemd should care about settings involving $HOME.
The `systemd --user` instance I'm running under my account has every right to look in my $HOME to find my own session services.
> Git probably needs XDG variables for the per-user gui settings (which I've never used)...
No, git keeps its configuration file in $XDG_CONFIG_HOME/git/config as of 1.8.0.
Even if it didn't, one invalid example would not mean all other examples automatically become invalid (which they aren't).
I would tend to say to bring them back. Setting them to sane defaults make sense otherwise we might end up with many users with broken systems. You could check if the XDG_*_HOME variables exist before overwriting them like it was done for the other XDG variables.
I noticed that kdelibs3 also modifies XDG_DATA_DIRS so I might need to do take care of it depending what we decide to do.
$ gr XDG /usr/bin/startxfce4| gr export
export XDG_DATA_DIRS
export XDG_CONFIG_DIRS
$ gr XDG /etc/xdg/xfce4/xinitrc | gr export
export XDG_MENU_PREFIX
I would also assume that gnome and kde4 are fine (probably {g,k}dm is required though).
Rearding default settings (remember, these are per-user), whouldn't it be logical to set them in /etc/skel/.bash_profile?
.bash_profile is too bash-specific. If it was renamed to .profile, it might be better – then it would also be respected by various DEs and other shells, not just bash. For example: <<'EOF'
[ "$XDG_CACHE_HOME" ] || export XDG_CACHE_HOME="$HOME/.cache"
[ "$XDG_CONFIG_HOME" ] || export XDG_CONFIG_HOME="$HOME/.config"
[ "$XDG_DATA_HOME" ] || export XDG_DATA_HOME="$HOME/.local/share"
if [ "$BASH" ] && [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
EOF
Looks like the cause of the problem is kdelibs3 package which ships /etc/profile.d/kde3.sh.
# XDG_DATA_DIRS="/opt/kde/share" gsettings list-schemas
Segmentation fault
# XDG_DATA_DIRS="" gsettings list-schemas; echo $?
apps.gecko-mediaplayer.preferences
ca.desrt.dconf-editor.Settings
...
# XDG_DATA_DIRS="/usr/share:/opt/kde/share" gsettings list-schemas; echo $?
apps.gecko-mediaplayer.preferences
...
If only /opt/kde/share is set then all is broken. Maybe that should be removed from kdelibs3 package together with the change in libx11?
I guess that mimeo might need some local changes. I've never used it.
Firefox core-dumps on start, but when I run the contents of the xorg.sh file in a Konsole window and then execute Firefox from there, it starts fine.
Or we bring the vars back in case they are not set at all. Then user setting will append on correct defaults.
* If user defines his/her own XDG environment, what's the point in setting defaults system-wide in the 1st place?
* The reason why kdelibs3 broke is because the profile script simply set XDG_DATA_DIRS to /opt/kde/... if it's empty, while the correct behavior would have been to set this var as ${default}:/opt/kde/... That was certainly against standards.
I think that the settings in /etc/ must be as generic and minimal and possible, and there is no point in providing settigns which user can easily set in his/her /home. For instance, if the user doesn't want to chase bugs in desktop apps, (s)he can simply set all XDG vars from libx11's profile in .bash_profile or .xinitrc (that's what I did, and none of my programs broke).
So, I'd prefer the 1st path, probably accompanied by a news announcement (I can write a draft if you want)...