zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: root's path
Date: Sat, 17 Mar 2012 08:33:31 -0700	[thread overview]
Message-ID: <120317083331.ZM2339@torch.brasslantern.com> (raw)
In-Reply-To: <CAHYJk3Qoev7k6b6761SiVUWBD-EjnxmXQCzwJrGxfwoM8sp8ug@mail.gmail.com>

On Mar 17, 12:21pm, Mikael Magnusson wrote:
}
} > Shouldn't $PATH be set in /etc/zshenv rather than zprofile?
} > Else, it's impossible to override $PATH in ~/.zshenv.
} 
} Absolutely not, if you set PATH from *env, it makes it impossible to
} inherit the PATH from the parent process' environment, even in
} scripts, which will break a lot of things.

I'd go further and say that except in carefully considered circumstances,
the /etc/zshenv file should always be empty or not exist.  If it does set
the path, it should only append to it, not prepend or clobber (again,
except in certain circumstances).

} The path should only be set once on login of the current session, ie
} in zprofile if zsh is your login shell, otherwise in the startup file
} for your login shell.

This is ideal but practically speaking has become unworkable in recent
years.  The use of remote terminals and window systems has resulted in
an unpredictable variety of configurations such that there is no way to
guarantee that any particular interactive shell is a login shell or was
started from a login shell environment; i.e., "current session" is now
pretty much meaningless in the process environment sense.

In fact the OP's most likely problem is that on the "good system" he
has a login shell (or there is one somewhere nearer the root of his
process tree), but on the "bad system" he has only an interactive shell.

So it's often necessary to adjust the path in /etc/zshrc to make sure it
is sane for all interactive shells.  Or, after careful consideration, to
do so in /etc/zshenv if the path for NON-interactive shells is incomplete.

-- 
Barton E. Schaefer


      parent reply	other threads:[~2012-03-17 15:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-17  1:45 sergio
2012-03-17  4:44 ` Benjamin R. Haskell
2012-03-17  8:58   ` sergio
     [not found] ` <alpine.LNX.2.01.1203170040230.18133__19065.733991056$1331959656$gmane$org@hp.internal>
2012-03-17 11:13   ` Christian Neukirchen
2012-03-17 11:21     ` Mikael Magnusson
2012-03-17 14:52       ` TJ Luoma
2012-03-17 14:54         ` Mikael Magnusson
2012-03-17 15:02           ` Mikael Magnusson
2012-03-17 15:33       ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=120317083331.ZM2339@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).