small question

Emmanuele Bassi zefram at wolverine.lohacker.home
Sun Mar 16 09:16:51 EST 2003


* Rene Pijlman <reply.in at the.newsgroup> [2003-03-16 13:56]:

>>  os.chdir(pwd.getpwnam(username)[5])
> 
> I think this is a better solution than os.environ['HOME'], even
> for the current user, since HOME is set to the user's home
> directory only by convention.

I disagree.

If the $HOME envvar has been changed by the user, every script should
follow the user's will, and behave accordingly.  Programs should not be
"smarter" than me, and act *in spite* of what I've told them to.

> It may be (re)set to anything in the execution environment of the
> script.

The point of having an environment variable is to permit changing its
value, while the home entry in the passwd file should be constant[1],
or, at least, changeable only by the system administrator.

+++

[1] Unless you are a BOFH, and your users have /dev/zero as shell and
/dev/null as home. ;-)

Bye,
 Emmanuele.

-- 
Emmanuele Bassi            |          [ http://digilander.iol.it/ebassi/ ]
emmanuele.bassi(at)iol.it  |
GnuPG Key fingerprint = 4DD0 C90D 4070 F071 5738  08BD 8ECC DB8F A432 0FF4




More information about the Python-list mailing list