zsh-users
 help / color / mirror / code / Atom feed
* Latest stable release of zsh triggers the addition of paths to $PATH
@ 2013-03-12 22:08 James Jong
  2013-03-12 22:18 ` Lawrence Velázquez
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: James Jong @ 2013-03-12 22:08 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

I first noticed this problem in Zsh 5.0.0, but I have just built Zsh 5.0.2
from scratch and every time I call exec zsh from another shell (e.g. tcsh).
My $PATH variable ends up with two additional paths, one pointing to
Keberos and another one pointing to a version of Qt.

I don't have anything in my .zprofile nor on my .zshrc.

Why are these paths added to $PATH? Any pointers on what I can look at?

Thanks,

James

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Latest stable release of zsh triggers the addition of paths to $PATH
  2013-03-12 22:08 Latest stable release of zsh triggers the addition of paths to $PATH James Jong
@ 2013-03-12 22:18 ` Lawrence Velázquez
  2013-03-12 22:26   ` James Jong
  2013-03-12 22:19 ` Nikolai Weibull
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Lawrence Velázquez @ 2013-03-12 22:18 UTC (permalink / raw)
  To: James Jong; +Cc: zsh-users

On Mar 12, 2013, at 6:08 PM, James Jong <ribonucleico@gmail.com> wrote:

> I first noticed this problem in Zsh 5.0.0, but I have just built Zsh 5.0.2
> from scratch and every time I call exec zsh from another shell (e.g. tcsh).
> My $PATH variable ends up with two additional paths, one pointing to
> Keberos and another one pointing to a version of Qt.
> 
> I don't have anything in my .zprofile nor on my .zshrc.
> 
> Why are these paths added to $PATH? Any pointers on what I can look at?

What OS are you on? Have you checked whether there are system initialization files that could be getting sourced (e.g., /etc/zshenv)?

vq

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Latest stable release of zsh triggers the addition of paths to $PATH
  2013-03-12 22:08 Latest stable release of zsh triggers the addition of paths to $PATH James Jong
  2013-03-12 22:18 ` Lawrence Velázquez
@ 2013-03-12 22:19 ` Nikolai Weibull
  2013-03-13  0:17 ` Phil Pennock
  2013-03-13  0:20 ` Vincent Lefevre
  3 siblings, 0 replies; 10+ messages in thread
From: Nikolai Weibull @ 2013-03-12 22:19 UTC (permalink / raw)
  To: James Jong; +Cc: zsh-users

On Tue, Mar 12, 2013 at 11:08 PM, James Jong <ribonucleico@gmail.com> wrote:
> I first noticed this problem in Zsh 5.0.0, but I have just built Zsh 5.0.2
> from scratch and every time I call exec zsh from another shell (e.g. tcsh).
> My $PATH variable ends up with two additional paths, one pointing to
> Keberos and another one pointing to a version of Qt.
>
> I don't have anything in my .zprofile nor on my .zshrc.

Make sure that /etc/zshenv isn’t doing something funky.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Latest stable release of zsh triggers the addition of paths to $PATH
  2013-03-12 22:18 ` Lawrence Velázquez
@ 2013-03-12 22:26   ` James Jong
  2013-03-13  0:20     ` Lawrence Velázquez
  0 siblings, 1 reply; 10+ messages in thread
From: James Jong @ 2013-03-12 22:26 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

Thanks. I just checked and /etc/zshenv is empty (it only has a few
automatically-generated comments explaining what it is for).

I'm on a Scientific Linux SL Release 5.1 (Boron).

James







On Tue, Mar 12, 2013 at 6:18 PM, Lawrence Velázquez <larryv@macports.org>wrote:

> On Mar 12, 2013, at 6:08 PM, James Jong <ribonucleico@gmail.com> wrote:
>
> > I first noticed this problem in Zsh 5.0.0, but I have just built Zsh
> 5.0.2
> > from scratch and every time I call exec zsh from another shell (e.g.
> tcsh).
> > My $PATH variable ends up with two additional paths, one pointing to
> > Keberos and another one pointing to a version of Qt.
> >
> > I don't have anything in my .zprofile nor on my .zshrc.
> >
> > Why are these paths added to $PATH? Any pointers on what I can look at?
>
> What OS are you on? Have you checked whether there are system
> initialization files that could be getting sourced (e.g., /etc/zshenv)?
>
> vq

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Latest stable release of zsh triggers the addition of paths to $PATH
  2013-03-12 22:08 Latest stable release of zsh triggers the addition of paths to $PATH James Jong
  2013-03-12 22:18 ` Lawrence Velázquez
  2013-03-12 22:19 ` Nikolai Weibull
@ 2013-03-13  0:17 ` Phil Pennock
  2013-03-13  0:20 ` Vincent Lefevre
  3 siblings, 0 replies; 10+ messages in thread
From: Phil Pennock @ 2013-03-13  0:17 UTC (permalink / raw)
  To: James Jong; +Cc: zsh-users

On 2013-03-12 at 18:08 -0400, James Jong wrote:
> I first noticed this problem in Zsh 5.0.0, but I have just built Zsh 5.0.2
> from scratch and every time I call exec zsh from another shell (e.g. tcsh).
> My $PATH variable ends up with two additional paths, one pointing to
> Keberos and another one pointing to a version of Qt.
> 
> I don't have anything in my .zprofile nor on my .zshrc.
> 
> Why are these paths added to $PATH? Any pointers on what I can look at?

tcsh> zsh -x

If you do that, and also capture stderr to a file, and immediately quit,
then you can grep the stderr output for references to PATH or path.
Ignore fpath, module_path, manpath, etc etc.

This should get rid of most of the cruft:
% pcregrep -n '\b(?i)path\b' zsh.trace

Use the line-numbers to find the matches in the full output and trace
back where the lines come from.

-Phil


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Latest stable release of zsh triggers the addition of paths to $PATH
  2013-03-12 22:08 Latest stable release of zsh triggers the addition of paths to $PATH James Jong
                   ` (2 preceding siblings ...)
  2013-03-13  0:17 ` Phil Pennock
@ 2013-03-13  0:20 ` Vincent Lefevre
  3 siblings, 0 replies; 10+ messages in thread
From: Vincent Lefevre @ 2013-03-13  0:20 UTC (permalink / raw)
  To: James Jong; +Cc: zsh-users

On 2013-03-12 18:08:10 -0400, James Jong wrote:
> I don't have anything in my .zprofile nor on my .zshrc.

There are other dotfiles that may be sourced. You can check with
strace.

Something like "grep Kerberos ~/.*" can also help you see where
the paths may come from (but this could also be under /etc).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Latest stable release of zsh triggers the addition of paths to $PATH
  2013-03-12 22:26   ` James Jong
@ 2013-03-13  0:20     ` Lawrence Velázquez
  2013-03-13 20:43       ` James Jong
  0 siblings, 1 reply; 10+ messages in thread
From: Lawrence Velázquez @ 2013-03-13  0:20 UTC (permalink / raw)
  To: James Jong; +Cc: zsh-users

On Mar 12, 2013, at 6:26 PM, James Jong <ribonucleico@gmail.com> wrote:

> Thanks. I just checked and /etc/zshenv is empty (it only has a few automatically-generated comments explaining what it is for).

Are there any other /etc/z* files?

vq

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Latest stable release of zsh triggers the addition of paths to $PATH
  2013-03-13  0:20     ` Lawrence Velázquez
@ 2013-03-13 20:43       ` James Jong
  2013-03-13 20:57         ` Greg Klanderman
  0 siblings, 1 reply; 10+ messages in thread
From: James Jong @ 2013-03-13 20:43 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]

Thanks yes. There are lots of /etc/z* files and some of them have stuff in
them, so that seems to be the problem. More specifically:

The file /etc/zprofile sources /etc/profile which has stuff in it
The file /etc/zshrc has the following:

if [ "x$SHLVL" != "x1" ]; then
    for i in /etc/profile.d/*.sh; do
        if [ -r "$i" ]; then
            . $i
        fi
    done
    unset i
fi


At this point I have some questions:

1) What doest the if statement above test?
2) When I run a zsh script, how can I prevent it from running /etc/zshrc?
3) When I switch to zsh from tcsh on an interactive shell using exec zsh
-l, how I can I prevent it from running  /etc/zprofile?


Thanks again for all your help,

James





On Tue, Mar 12, 2013 at 8:20 PM, Lawrence Velázquez <larryv@macports.org>wrote:

> On Mar 12, 2013, at 6:26 PM, James Jong <ribonucleico@gmail.com> wrote:
>
> > Thanks. I just checked and /etc/zshenv is empty (it only has a few
> automatically-generated comments explaining what it is for).
>
> Are there any other /etc/z* files?
>
> vq

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Latest stable release of zsh triggers the addition of paths to $PATH
  2013-03-13 20:43       ` James Jong
@ 2013-03-13 20:57         ` Greg Klanderman
  2013-03-14 13:40           ` James Jong
  0 siblings, 1 reply; 10+ messages in thread
From: Greg Klanderman @ 2013-03-13 20:57 UTC (permalink / raw)
  To: zsh-users

>>>>> On March 13, 2013 James Jong <ribonucleico@gmail.com> wrote:

> 1) What doest the if statement above test?

whether the file is readable.  the loop loads all readable files
matching the pattern /etc/profile.d/*.sh

> 2) When I run a zsh script, how can I prevent it from running /etc/zshrc?

zsh -f

> 3) When I switch to zsh from tcsh on an interactive shell using exec zsh -l,
> how I can I prevent it from running /etc/zprofile?

I use "setopt norcs" in my .zshenv and then specifically load the
files I want to load depending on whether the shell is a login shell,
interactive, etc.  You could also use "setopt noglobalrcs" which only
prevents loading the global (/etc/...) ones.  Note that without the
"-f" command-line option, you cannot prevent loading /etc/zshenv
(alternately /etc/zsh/zshenv on some systems).

Greg


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Latest stable release of zsh triggers the addition of paths to $PATH
  2013-03-13 20:57         ` Greg Klanderman
@ 2013-03-14 13:40           ` James Jong
  0 siblings, 0 replies; 10+ messages in thread
From: James Jong @ 2013-03-14 13:40 UTC (permalink / raw)
  To: gak; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1241 bytes --]

Thanks Greg! These are fantastic pointers.

As for the if statement, I was referring to the first one, i.e.

if [ "x$SHLVL" != "x1" ]; then
...
fi

But I think this thread answers my question:
http://stackoverflow.com/questions/4511407/how-do-i-know-if-im-running-a-nested-shell

James





On Wed, Mar 13, 2013 at 4:57 PM, Greg Klanderman <gak@klanderman.net> wrote:

> >>>>> On March 13, 2013 James Jong <ribonucleico@gmail.com> wrote:
>
> > 1) What doest the if statement above test?
>
> whether the file is readable.  the loop loads all readable files
> matching the pattern /etc/profile.d/*.sh
>
> > 2) When I run a zsh script, how can I prevent it from running /etc/zshrc?
>
> zsh -f
>
> > 3) When I switch to zsh from tcsh on an interactive shell using exec zsh
> -l,
> > how I can I prevent it from running /etc/zprofile?
>
> I use "setopt norcs" in my .zshenv and then specifically load the
> files I want to load depending on whether the shell is a login shell,
> interactive, etc.  You could also use "setopt noglobalrcs" which only
> prevents loading the global (/etc/...) ones.  Note that without the
> "-f" command-line option, you cannot prevent loading /etc/zshenv
> (alternately /etc/zsh/zshenv on some systems).
>
> Greg
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-03-14 13:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-12 22:08 Latest stable release of zsh triggers the addition of paths to $PATH James Jong
2013-03-12 22:18 ` Lawrence Velázquez
2013-03-12 22:26   ` James Jong
2013-03-13  0:20     ` Lawrence Velázquez
2013-03-13 20:43       ` James Jong
2013-03-13 20:57         ` Greg Klanderman
2013-03-14 13:40           ` James Jong
2013-03-12 22:19 ` Nikolai Weibull
2013-03-13  0:17 ` Phil Pennock
2013-03-13  0:20 ` Vincent Lefevre

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).