zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: J?rg Sommer <joerg@alea.gnuu.de>
Cc: zsh-workers@sunsite.dk
Subject: Re: environment settings
Date: Fri, 20 Jun 2008 23:26:49 -0700	[thread overview]
Message-ID: <20080621062649.GA28022@blorf.net> (raw)
In-Reply-To: <slrng5etlu.mft.joerg@alea.gnuu.de>

On Tue, Jun 17, 2008 at 08:33:02AM +0000, J?rg Sommer wrote:
> And what's the meaning of .zshenv? I use it for my environment variables
> like EDITOR, because my session is started by X.

I've been bitten by unwanted side effects when using .zshenv to set
environment variables, so the following lines are pretty much the
entirety of my .zshenv file these days:

if [[ $SHLVL == 1 && ! -o LOGIN ]]; then
    source ~/.zprofile
fi

The problem I ran into with setting variables in .zshenv is that they
can override settings you want to affect a program and/or script when
you don't expect it.  For instance, if you need to debug a C program
that is run inside a script with a custom PATH.  You setup the custom
PATH and run the C program under gdb, and discover that your PATH isn't
set right for the C program.  This is because gdb starts the program
under an instance of $SHELL, which will source .zshenv, and if you're
setting PATH inside, that blasts the PATH setting you're expecting.
A similar problem arises for any zsh script that you want to run inside
a customized environment -- the .zshenv values always override any
settings you made prior to starting the script.

..wayne..


  parent reply	other threads:[~2008-06-21  6:25 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080616074651.GB26165@marcus>
     [not found] ` <20080616080556.GA5091@sc.homeunix.net>
     [not found]   ` <20080616123045.GC26165@marcus>
     [not found]     ` <20080616124450.GC5091@sc.homeunix.net>
2008-06-17  8:33       ` Jörg Sommer
2008-06-17  9:39         ` Stephane Chazelas
2008-06-17 10:41           ` Vincent Lefevre
2008-06-17 12:58             ` Stephane Chazelas
2008-06-17 13:11               ` Vincent Lefevre
2008-06-17 13:26                 ` Stephane Chazelas
2008-06-17 13:28                   ` Mikael Magnusson
2008-06-17 14:25                     ` Stephane Chazelas
2008-06-17 15:54                       ` Vincent Lefevre
2008-06-17 16:00                         ` Stephane Chazelas
2008-06-17 19:50                           ` Vincent Lefevre
2008-06-17 20:32                             ` Stephane Chazelas
2008-06-18 10:38                               ` Vincent Lefevre
2008-06-18 11:52                                 ` Stephane Chazelas
2008-06-18 17:11                                   ` Bart Schaefer
2008-06-17 14:55                     ` Vincent Lefevre
2008-06-17 14:45                   ` Vincent Lefevre
2008-06-18  8:49           ` Jörg Sommer
2008-06-18  9:33             ` Stephane Chazelas
2008-06-21  6:26         ` Wayne Davison [this message]
2008-06-21 11:36           ` Vincent Lefevre
2008-06-21 12:30             ` Stephane Chazelas
2008-06-22  8:41               ` Vincent Lefevre
2008-06-23 15:24                 ` Stephane Chazelas
2008-06-23 16:16                   ` Vincent Lefevre
2008-06-23 16:20                   ` Bart Schaefer
2008-06-23 16:29                     ` Stephane Chazelas

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=20080621062649.GA28022@blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=joerg@alea.gnuu.de \
    --cc=zsh-workers@sunsite.dk \
    /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).