zsh-users
 help / color / mirror / code / Atom feed
From: Kurtis Rader <krader@skepticism.us>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: PSA: Mac OS X El Capitan upgrade might break your $PATH
Date: Fri, 31 Jul 2015 15:10:30 -0700	[thread overview]
Message-ID: <CABx2=D93LwdOJffOLEmLXb1irdPn0oDEp1oJQrS0BJhH2KSNzA@mail.gmail.com> (raw)
In-Reply-To: <CAHYJk3S-W_FYWEidfhC_g62=8B3hRLoyGnnOQsJcy4FPp9Ct5g@mail.gmail.com>

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

On Fri, Jul 31, 2015 at 11:53 AM, Mikael Magnusson <mikachu@gmail.com>
wrote:

> That's good news, they used to have that code in /etc/zshenv which
> meant you had _no_ way to override it. It only took them a few years
> to fix this.
>
> As a sidenote, it's not a great idea to set your path in .zshenv, you
> should probably move those settings to your .zprofile. (Otherwise,
> running a script that uses zsh will not use the $PATH from the
> environment, which can break things in some situations).
>

It's a trade-off. Back when ksh93 was my primary shell I had a ~/.environ
file where I put such things. Then I sourced that from ~/.profile and my
crontab entries. That way my cron jobs would have an environment consistent
with my interactive shells. Zsh's .zshenv makes things much easier. It also
means that when I do something like

ssh home "some_command"

that command gets the same environment it would have if I had gotten an
interactive shell and run the command.

I protect against the problem you mention by checking if PATH contains
$HOME/bin. If it does I assume it's already been initialized to a
reasonable value and leave it alone. If not I install my own PATH.

Of course this is only a problem if you shadow commands -- something most
people don't do. In my case I have wrappers around things like ssh in my
~/bin directory that I want to have precedence over the system supplied
version.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

      parent reply	other threads:[~2015-07-31 22:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-31 16:35 Kurtis Rader
2015-07-31 17:22 ` Bart Schaefer
2015-07-31 18:53 ` Mikael Magnusson
2015-07-31 21:05   ` Andrew Janke
2015-07-31 22:01     ` Kurtis Rader
2015-07-31 22:29       ` Andrew Janke
2015-07-31 22:49         ` Kurtis Rader
2015-07-31 22:10   ` Kurtis Rader [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='CABx2=D93LwdOJffOLEmLXb1irdPn0oDEp1oJQrS0BJhH2KSNzA@mail.gmail.com' \
    --to=krader@skepticism.us \
    --cc=mikachu@gmail.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).