Bug 65509

Summary: Zshenv should not source /etc/profile
Product: [Retired] Red Hat Linux Reporter: Zvi Har'El <rl>
Component: zshAssignee: Jens Petersen <petersen>
Status: CLOSED RAWHIDE QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: s.traylen
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-02-10 13:48:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 62788    
Bug Blocks:    

Description Zvi Har'El 2002-05-26 08:53:34 UTC
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 19:23:19 UTC
It was done for consistency with bash - see bug #62788

Comment 2 Steve Bonneville 2002-08-19 20:09:30 UTC
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 17:02:07 UTC
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-25 02:59:59 UTC
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.


Comment 5 Jens Petersen 2002-11-25 03:01:35 UTC
(Cc'ing bash package owner.)

Comment 6 Jens Petersen 2002-11-25 03:18:14 UTC
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-25 03:39:09 UTC
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 08:18:17 UTC
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 08:01:08 UTC
*** Bug 106950 has been marked as a duplicate of this bug. ***