Description of Problem: Recently /etc/zshenv was patched to source /etc/profile. Previously, this was done by /etc/zprofile. This is against the specification of zsh, which says that /etc/zprofile is sourced only by a login shell (and /etc/profile should be sourced only by such shell, see bash manual page), and /etc/zshenv is sourced by all shells. Version-Release number of selected component (if applicable): How Reproducible: Always Steps to Reproduce: 1. run zsh -x 2. 3. Actual Results: /etc/profile is read and all /etc/profile.d/* files Expected Results: Additional Information:
It was done for consistency with bash - see bug #62788
The fix that was suggested and implemented in bug #62788 seems wrong. The file that should've been changed so zsh mimics bash is /etc/zshrc (which is like the /etc/bashrc file), not /etc/zshenv. Now /etc/profile is being sourced by all zsh shell scripts! You can verify this by comparing the output of the shell script #!/bin/zsh alias to the script #!/bin/bash alias I think that for consistency with bash 1. /etc/zshenv should be empty 2. /etc/zprofile should source /etc/profile 3. /etc/zshrc should be set up like /etc/bashrc
There is a big difference between /etc/zshrc and /etc/bashrc. The former is read by every interactve shell just before ~/.zshrc, if the user wants it or not. On the other hand, bash doesnot read /etc/bashrc at all in the standard configuration. It reads only ~/.bashrc, and this may source /etc/bashrc. Redhat supplied ~/.bashrc is # .bashrc # User specific aliases and functions # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi But this may of course be easily modified by the user. It is possible to supply a system wide intereactive configuration by editing the file config-top.h in bash-2 distribution, which has the lines /* System-wide .bashrc file for interactive shells. */ /* #define SYS_BASHRC "/etc/bash.bashrc" */ But this is not done in redhat's installation. I think this differnce should be considered when deciding about redhat's default system-wide startup files.
rl.ac.il wrote: >There is a big difference between /etc/zshrc and /etc/bashrc. The >former is read by every interactve shell just before ~/.zshrc, if the >user wants it or not. On the other hand, bash doesnot read /etc/bashrc >at all in the standard configuration. It reads only ~/.bashrc, and >this may source /etc/bashrc. Redhat supplied ~/.bashrc is > ># .bashrc ># User specific aliases and functions ># Source global definitions > >if [ -f /etc/bashrc ]; then . /etc/bashrc fi > >But this may of course be easily modified by the user. It is possible >to supply a system wide intereactive configuration by editing the file >config-top.h in bash-2 distribution, which has the lines > >/* System-wide .bashrc file for interactive shells. */ >/* #define SYS_BASHRC "/etc/bash.bashrc" */ > >But this is not done in redhat's installation. I think this differnce >should be considered when deciding about redhat's default system-wide >startup files.
(Cc'ing bash package owner.)
I just note in passing too that sourcing /etc/profile from /etc/zshenv causes zsh's "make test" to fail also. Isn't the right thing to do then to add a "/etc/skel/.zshrc" which sources "/etc/profile" like .bashrc?
Ugh, just realised that this can only be fixed on existing systems by hand since the config files are %config(noreplace).
In zsh-4.0.6-1 the sourcing of /etc/profile is now done in the default .zshrc file, not /etc/zshenv. I hope this improves things.
*** Bug 106950 has been marked as a duplicate of this bug. ***