Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 10724

Summary: app-shells/zsh-4.0.6-r2 global startup files
Product: Gentoo Linux Reporter: James Michael Fultz <croooow>
Component: New packagesAssignee: phoen][x <fisi.tilman.klar>
Status: RESOLVED FIXED    
Severity: normal    
Priority: High    
Version: 1.2   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: zshenv

Description James Michael Fultz 2002-11-14 03:42:44 UTC
I hope to help solve two problems I've encountered and am sure affects other
Gentoo Linux and Zsh users. One is that Zsh doesn't incorporate the setup from
env.d without adding some code for it to my local startup files.  The other is
that the files `zshenv', `zshrc', and `zlogin' in the directory `/etc/zsh'
should not be installed as global startup files.  They are only meant as
examples and are commented as such.  The following line is taken from
`/etc/zsh/zshenv':

# THIS FILE IS NOT INTENDED TO BE USED AS /etc/zshenv, NOR WITHOUT EDITING

Both `zshrc' and `zlogin' bear similar comments.

My suggestion is that these three files not be installed, but rather the
following `zshenv' I've created be used instead:

--- Begin zshenv ---
if [[ -o rcs ]]
then
	if [[ -e "/etc/profile.env" ]]
	then
		  source /etc/profile.env
	fi

	#077 would be more secure, but 022 is generally quite realistic
	umask 022

	if [[ $(/usr/bin/whoami) == 'root' ]]
	then
		export PATH="/bin:/sbin:/usr/bin:/usr/sbin:${ROOTPATH}"
	else
		export PATH="/bin:/usr/bin:${PATH}"
	fi
	unset ROOTPATH
fi

--- End zshenv ---

Since Zsh is a superset of the POSIX and Bourne shells, I used `/etc/profile' as
template.  I've tested this file on my system and have had no problems.
Comment 1 James Michael Fultz 2002-11-14 04:18:24 UTC
Created attachment 5658 [details]
zshenv

I later made some minor improvements in `zshenv'.  Perhaps increasing
efficiency the tiniest amount, but mostly improving readability by reducing the
level of indent.
Comment 2 phoen][x 2002-11-15 10:03:14 UTC
Eek, now who put these files into /etc/zsh in the first place?

I removed zshrc and zshlogin and replaced zshenv with your version.
Works pretty well here, thanks for the contribution James.

-phoen][x-