Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 348622 - app-shell/zsh: system config files provided by package manager override user settings.
Summary: app-shell/zsh: system config files provided by package manager override user ...
Status: RESOLVED DUPLICATE of bug 19924
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Torsten Veller (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-13 14:13 UTC by Ryoichiro Suzuki
Modified: 2011-04-11 19:29 UTC (History)
2 users (show)

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


Attachments
zshenv of debian's zsh-4.3.6 (zshenv,623 bytes, text/plain)
2010-12-14 13:05 UTC, Ryoichiro Suzuki
Details
zprofile of debian's zsh-4.3.6 (zprofile,264 bytes, text/plain)
2010-12-14 13:06 UTC, Ryoichiro Suzuki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ryoichiro Suzuki 2010-12-13 14:13:27 UTC
first off i'm not really sure if it should be called a bug or a feature.

zsh's system-wide config files(particularly /etc/profile.env source'ed by  /etc/zsh/zprofile) override user defined settings like $PATH by default installation. This happenes due to that /etc/profile.env defines vars from scratch and that it's source'ed after ~/.zshenv where users basic settings go into.

i know that everything in gentoo is up to users and it's not a big deal to modify the config files by themself after installation. but still this problem might confuse newbies because $PATH and such defined in ~/.zshenv are overriden.

This problem is only occured when zsh is invoked as login shell because zprofile is only read by login shells.
startup files of zsh as login shell is shown below in order.
/etc/zsh/zshenv -> ~/.zshenv -> /etc/zsh/zprofile -> ~/.zprofile -> ...

i suggest moving current content of /etc/zsh/zprofile to /etc/zsh/zshenv



Reproducible: Always
Comment 1 Ben Sagal 2010-12-14 09:42:53 UTC
I am not sure that is a great idea as all the commands will be run on each invocation of zsh which seem wasteful.
Comment 2 Ryoichiro Suzuki 2010-12-14 13:03:39 UTC
hi,
Do you mean contents of /etc/zsh/zprofile by "all the commands"?
If so let's see /etc/{zsh/zprofile,profile.env}.
These two files set important environment variables of system such as PATH, MANPATH and so. I think those env vars should be set for both login and non-login shells. Consequently the best place for those env vars is zshenv rather than zprofile, as i mentioned which is only read by login shells.

For reference i attached Debian's /etc/zsh/{zshenv,zprofile}.
Comment 3 Ryoichiro Suzuki 2010-12-14 13:05:45 UTC
Created attachment 257127 [details]
zshenv of debian's zsh-4.3.6
Comment 4 Ryoichiro Suzuki 2010-12-14 13:06:34 UTC
Created attachment 257129 [details]
zprofile of debian's zsh-4.3.6
Comment 5 Ben Sagal 2010-12-15 07:21:54 UTC
neither of the debian files are setting up all the environmental variables as you suggest to do, the only thing set up in the zshenv is PATH in the case that it has not been properly initialized, this is not the same as initializing all the environmental as is done in the gentoo zprofile
Comment 6 Ben Sagal 2010-12-15 07:33:26 UTC
From what I can tell debian prefers the use of pam_env for setting up environmental variables
Comment 7 Ryoichiro Suzuki 2010-12-15 15:30:16 UTC
hi,
sry if debian's example was not appropriate. I should have taken exherbo instead. My suggestion to move zshenv to zprofile was one of solutions.

The problem that I'd like to point out is exactly what the summary says. If one uses ~/.zshenv to set PATH and umask these settings will eventually discarded by /etc/zsh/zprofile. This behaviour doesn't look nice as a default installation state.
Or is it only me to use ~/.zshenv? If so please ignore me then close the bug:)
(I try to stick to zshenv instead of zprofile because environment inheritance doesn't always work as expected in some case when using a display manager with tmux/screen which is first run by session manager.)
Comment 8 Torsten Veller (RETIRED) gentoo-dev 2011-01-03 09:46:08 UTC
This bug is a dup of bug 19924, isn't it?
Comment 9 Torsten Veller (RETIRED) gentoo-dev 2011-01-18 08:51:09 UTC

*** This bug has been marked as a duplicate of bug 19924 ***
Comment 10 Michael Weber (RETIRED) gentoo-dev 2011-04-11 19:18:02 UTC
(In reply to comment #7)
> Or is it only me to use ~/.zshenv? If so please ignore me then close the bug:)
> (I try to stick to zshenv instead of zprofile because environment inheritance
> doesn't always work as expected in some case when using a display manager with
> tmux/screen which is first run by session manager.)

No, you aren't.

stuff you'd like to have in non-interactive and interactive shells belong to .zshenv, like PATH (including users modifications), LC_* LANG and so on.

stuff you only need in interactive shells, like PS1, aliases, convenience functions, HISTFILE, the whole zsh-prompt setup belongs to zprofile/.zshrc