Subject: Re: make should unset $ENV
To: Simon J. Gerraty <sjg@crufty.net>
From: Todd Vierling <tv@pobox.com>
List: tech-toolchain
Date: 08/01/2003 07:41:34
On Fri, 1 Aug 2003, Simon J. Gerraty wrote:

: Both our /bin/sh and ksh will use the file pointed to by $ENV as a
: startup script (like csh's .cshrc).  It occurs to me that any build
: that relies on $ENV being set and doing something is in serious
: trouble.

Really?  ISTM that your $ENV script is ill-behaved if it futzes with make.
I have set ENV=$HOME/.shrc for years now with no ill effect on make(1).

A common mistake is to put things that try to mess with the process
environment (export *) or the terminal (stty/tset/etc.) in the $ENV script.
Such things should, rather, be in .profile/.klogin/.bash_profile.  And,
anything that messes with how a shell works interactively should be using a
case block:

case $- in
*i*)
	...interactive shell commands go here...
	;;
esac

make(1) is certainly *not* the only thing that will barf on a poorly written
$ENV script if these rules are not followed.

-- 
-- Todd Vierling <tv@pobox.com>