Date: Mon, 10 Mar 1997 23:10:57 -0600 From: Steve Price <sprice@hiwaay.net> To: un_x@hotmail.com Cc: FreeBSD-gnats-submit@freefall.freebsd.org, freebsd-bugs@freefall.freebsd.org Subject: Re: bin/2934: sh(1) has problems with $ENV Message-ID: <3324E961.41C67EA6@hiwaay.net> References: <199703102355.AAA10899@uriah.heep.sax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
steve howe wrote: > > >Number: 2934 > >Category: bin > >Synopsis: sh(1) has problems with $ENV > > /bin/sh in any FreeBSD system so far. > > >Description: > > /bin/sh processes $ENV fine if it has been set inside ~/.profile like: > > ENV=${HOME}/.env; export ENV > > However, it fails to source $ENV in this case: > > export ENV=${HOME}/.env > > >How-To-Repeat: > > Use: > > export ENV=${HOME}/.env > > in your ~/.profile, and re-invoke another level of sh(1). $ENV won't > be read. Now invoke any other Bourne-alike shell (pdksh, ksh93, > bash), it will process $ENV correctly. > I tried this and it didn't appear to work at first, but I believe it is because of this. steve[~]$ grep steve /etc/passwd steve:*:1000:1000:Steve Price:/home/steve:/bin/bash steve[~]$ echo $ENV /home/steve/.bashrc steve[~]$ cat /home/steve/.bashrc steve[~]$ cat /home/steve/.profile export ENV=${HOME}/env-stuff echo ~/.profile steve[~]$ cat /home/steve/env-stuff echo "Yep I'm here!" steve[~]$ sh \u[\w]\$ exit steve[~]$ But after I change my login shell to /bin/sh or do a export ENV=${HOME}/env-stuff. It works as suspected. It appears to be a problem in that ~/.bash_profile is getting sourced and ENV is picked up from there. The reason that this would matter is that ~/.profile (or ~/.bash_profile for bash's case) is only getting sourced when it is started as a login shell. So just typing 'sh' will not source ~/.profile, but will source $ENV (which was set by your login shell) if your euid == uid && egid == gid. Could this be the case with you as well? Steve > >Fix: > > Not known. > > >Audit-Trail: > >Unformatted: > [This PR sent by joerg on behalf of Steve who doesn't have a good > enough IP connectivity.]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3324E961.41C67EA6>