[indiana-discuss] Code review request

Roland Mainz roland.mainz at nrubsig.org
Thu Jan 31 21:14:35 PST 2008


David.Comay at Sun.COM wrote:
> 
> > Yes and no. The PATH, MANPATH and PAGER variables should be set in
> > either /etc/profile or ~/.profile to affect all shells and should not be
> > stored in ~/.bashrc (I forgot to say that in my last review comment (if
> > anyone is now completely confused: The seperation rules work like this:
> > If it should only affect the shell itself in interactive mode the
> > variable goes into /etc/bash.bashrc||~/.bashrc (for bash) or
> > /etc/ksh.kshrc||~/.kshrc (for ksh) and should not be exported into the
> > environment, if the setting should affect anything outside the shell the
> > variable goes into /etc/profile or ~/.profile and gets exported into the
> > environment)).
> 
> Understood about the separation but in this case, I want to limit the
> changes to strictly the new user's bashrc file.  We'll later expand
> this to include other shells via /etc/profile or ~/.profile if it's
> deemed appropriate.

The problem is that that the *bashrc and *kshrc files are executed for
each interactive shell. If anyone uses the ~/.bashrc in the patch you
get some behaviour which user may not expect, e.g.
-- snip --
$ bash
$ echo $PATH
/usr/gnu/bin:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin
$ export PATH=/home/jack/mybins
$ echo $PATH
/home/jack/mybins
$ bash
$ echo $PATH
/usr/gnu/bin:/usr/bin:/usr/X11/bin:/usr/sbin:/sbin
$ exit
$ echo $PATH
/home/jack/mybins
-- snip --
... e.g. each new bash instance will wallpaper over the PATH, MANPATH
and PAGER environment variables, even if the user doesn't want that.

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)


More information about the indiana-discuss mailing list