Bug 65509 - Zshenv should not source /etc/profile
Zshenv should not source /etc/profile
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: zsh (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jens Petersen
Aaron Brown
:
: 106950 (view as bug list)
Depends On: 62788
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-26 04:53 EDT by Zvi Har'El
Modified: 2007-04-18 12:42 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-02-10 08:48:16 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Zvi Har'El 2002-05-26 04:53:34 EDT
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:
Comment 1 Trond Eivind Glomsrxd 2002-06-14 15:23:19 EDT
It was done for consistency with bash - see bug #62788
Comment 2 Steve Bonneville 2002-08-19 16:09:30 EDT
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


Comment 3 Zvi Har'El 2002-08-20 13:02:07 EDT
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.
Comment 4 Jens Petersen 2002-11-24 21:59:59 EST
rl@math.technion.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.
Comment 5 Jens Petersen 2002-11-24 22:01:35 EST
(Cc'ing bash package owner.)
Comment 6 Jens Petersen 2002-11-24 22:18:14 EST
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?
Comment 7 Jens Petersen 2002-11-24 22:39:09 EST
Ugh, just realised that this can only be fixed on existing systems
by hand since the config files are %config(noreplace).
Comment 8 Jens Petersen 2002-11-28 03:18:17 EST
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.
Comment 9 Jens Petersen 2003-11-25 03:01:08 EST
*** Bug 106950 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.