* Broken /etc/zshrc ? @ 2001-08-19 15:51 Vincent Lefevre 2001-08-19 16:55 ` Borsenkow Andrej 2001-08-19 18:06 ` Bart Schaefer 0 siblings, 2 replies; 5+ messages in thread From: Vincent Lefevre @ 2001-08-19 15:51 UTC (permalink / raw) To: zsh-users The /etc/zshrc (system zshrc file) contains the following line: source /etc/profile But /etc/profile sets the path (I think this is OK). Thus, if a user sets his path in his .zshenv, then this path is lost because /etc/zshrc is sourced after the user's .zshenv file. I don't know if the /etc/zshrc was provided when compiling and installing zsh or provided by my Linux distribution (SuSE 7.2). Isn't this /etc/zshrc file broken? Shouldn't the /etc/profile be sourced in the /etc/zshenv (which doesn't exist here)? -- Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100% validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des Jeux Mathématiques et Logiques, TETRHEX, etc. Work: CR INRIA - computer arithmetic / SPACES project at LORIA ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Broken /etc/zshrc ? 2001-08-19 15:51 Broken /etc/zshrc ? Vincent Lefevre @ 2001-08-19 16:55 ` Borsenkow Andrej 2001-08-19 18:06 ` Bart Schaefer 1 sibling, 0 replies; 5+ messages in thread From: Borsenkow Andrej @ 2001-08-19 16:55 UTC (permalink / raw) To: Vincent Lefevre; +Cc: zsh-users Vincent Lefevre wrote: > The /etc/zshrc (system zshrc file) contains the following line: > > source /etc/profile > > But /etc/profile sets the path (I think this is OK). Thus, if a > user sets his path in his .zshenv, then this path is lost because > /etc/zshrc is sourced after the user's .zshenv file. > > I don't know if the /etc/zshrc was provided when compiling and > installing zsh or provided by my Linux distribution (SuSE 7.2). zsh does not install any startup files > Isn't this /etc/zshrc file broken? Shouldn't the /etc/profile > be sourced in the /etc/zshenv (which doesn't exist here)? > /etc/profile should be sourced in /etc/zprofile if at all. Irrespectively, unconditional setting of PATH is always bad - PATH may be already preset to some reasonable value. -andrej ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Broken /etc/zshrc ? 2001-08-19 15:51 Broken /etc/zshrc ? Vincent Lefevre 2001-08-19 16:55 ` Borsenkow Andrej @ 2001-08-19 18:06 ` Bart Schaefer 2001-08-19 19:12 ` Vincent Lefevre 1 sibling, 1 reply; 5+ messages in thread From: Bart Schaefer @ 2001-08-19 18:06 UTC (permalink / raw) To: Vincent Lefevre, zsh-users On Aug 19, 5:51pm, Vincent Lefevre wrote: } } The /etc/zshrc (system zshrc file) contains the following line: } } source /etc/profile } } Isn't this /etc/zshrc file broken? Shouldn't the /etc/profile } be sourced in the /etc/zshenv (which doesn't exist here)? I would think /etc/profile should be sourced in /etc/zprofile, if at all. /etc/zshenv is sourced by *every* zsh, even non-interactive scripts that are started with "zsh -f". /etc/profile is intended to be sourced by login shells. /etc/zshrc is sourced by login shells, but also by other interactive shells. I'm not sure why so many linux distributors thought that /etc/profile needed to be read from /etc/zshrc, but it seems to be a common problem. RedHat has finally got this bit right as of the 3.0.7 RPM, but that one still has other cruft in /etc/zshrc. (I haven't looked at the RPMs for RawHide.) I know the Mandrake folks put quite a bit of thought & effort into setting up the /etc/z* files because of issues setting up the local language environment. } But /etc/profile sets the path (I think this is OK). Thus, if a } user sets his path in his .zshenv, then this path is lost because } /etc/zshrc is sourced after the user's .zshenv file. This would still be true with /etc/zprofile, unfortunately. You could put "source ~/.zshenv" in ~/.zshrc ... or you could put "readonly path" in ~/.zshenv, I suppose. Or in 4.0.x ~/.zshenv could start with setopt no_global_rcs [[ -o login && -r /etc/zprofile ]] && source /etc/zprofile [[ -o interactive && -r /etc/zshrc ]] && source /etc/zshrc [[ -o login && -r /etc/zlogin ]] && source /etc/zlogin to cause all the /etc/z* files to be loaded before any of your own. In that case ~/.zlogout should end with [[ -r /etc/zlogout ]] && source /etc/zlogout However, if zsh was compiled with a global RCs location other than /etc, the above could get you into trouble. } I don't know if the /etc/zshrc was provided when compiling and } installing zsh or provided by my Linux distribution (SuSE 7.2). It wasn't provided when compiling and installing zsh. We generally recommend that (with exceptions like Mandrake's language environment) the /etc/z* files not be used at all. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Broken /etc/zshrc ? 2001-08-19 18:06 ` Bart Schaefer @ 2001-08-19 19:12 ` Vincent Lefevre 2001-08-19 23:45 ` Bart Schaefer 0 siblings, 1 reply; 5+ messages in thread From: Vincent Lefevre @ 2001-08-19 19:12 UTC (permalink / raw) To: zsh-users On Sun, Aug 19, 2001 at 18:06:06 +0000, Bart Schaefer wrote: > I would think /etc/profile should be sourced in /etc/zprofile, if at all. Thanks, I've sent a mail to SuSE support about that. > /etc/zshenv is sourced by *every* zsh, even non-interactive scripts that > are started with "zsh -f". /etc/profile is intended to be sourced by > login shells. /etc/zshrc is sourced by login shells, but also by other > interactive shells. I'm not sure why so many linux distributors thought > that /etc/profile needed to be read from /etc/zshrc, but it seems to be > a common problem. Yes, I have a 6.x RedHat at my lab and there is the same problem. > } But /etc/profile sets the path (I think this is OK). Thus, if a > } user sets his path in his .zshenv, then this path is lost because > } /etc/zshrc is sourced after the user's .zshenv file. > > This would still be true with /etc/zprofile, unfortunately. So, is sourcing the /etc/profile a good idea? Shouldn't it be sourced only if the shell is a login shell? > You could put "source ~/.zshenv" in ~/.zshrc ... I don't like that very much. > or you could put "readonly path" in ~/.zshenv, The path is modified, but there are other problems (e.g. ls colors). > I suppose. Or in 4.0.x ~/.zshenv could start with > > setopt no_global_rcs This is what I currently do. > [[ -o login && -r /etc/zprofile ]] && source /etc/zprofile > [[ -o interactive && -r /etc/zshrc ]] && source /etc/zshrc > [[ -o login && -r /etc/zlogin ]] && source /etc/zlogin OK, if I need to read these files, I'll do this. -- Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/> - 100% validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International des Jeux Mathématiques et Logiques, TETRHEX, etc. Work: CR INRIA - computer arithmetic / SPACES project at LORIA ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Broken /etc/zshrc ? 2001-08-19 19:12 ` Vincent Lefevre @ 2001-08-19 23:45 ` Bart Schaefer 0 siblings, 0 replies; 5+ messages in thread From: Bart Schaefer @ 2001-08-19 23:45 UTC (permalink / raw) To: Vincent Lefevre, zsh-users On Aug 19, 9:12pm, Vincent Lefevre wrote: } } So, is sourcing the /etc/profile a good idea? Shouldn't it be sourced } only if the shell is a login shell? If it were sourced from /etc/zprofile, then it would be sourced only if the shell were a login shell, because that's the rule for /etc/zprofile. } > [[ -o login && -r /etc/zprofile ]] && source /etc/zprofile } > [[ -o interactive && -r /etc/zshrc ]] && source /etc/zshrc } > [[ -o login && -r /etc/zlogin ]] && source /etc/zlogin } } OK, if I need to read these files, I'll do this. You may not need to read those files. It depends on what the sysadmin has put in them. E.g., as I mentioned before, on Mandrake your local language environment won't be set up correctly if you don't read them. I don't know about SuSE. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-08-19 23:45 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2001-08-19 15:51 Broken /etc/zshrc ? Vincent Lefevre 2001-08-19 16:55 ` Borsenkow Andrej 2001-08-19 18:06 ` Bart Schaefer 2001-08-19 19:12 ` Vincent Lefevre 2001-08-19 23:45 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).