Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Is a pristine shell allowed to set HOME? (fwd)



Zsh seems to be the odd man out, here.

---------- Forwarded message ----------
Date: Sun, 5 Feb 2006 20:14:07 +0100
From: Jens Schweikhardt <schweikh@xxxxxxxxxxxxxxxx>
To: austin-group-l@xxxxxxxxxxxxx
Subject: Is a pristine shell allowed to set HOME?
Resent-Date: 5 Feb 2006 19:15:00 -0000
Resent-From: austin-group-l@xxxxxxxxxxxxx
Resent-To: austin-group-l@xxxxxxxxxxxxx

hello, world\n

I'm currently pondering the question, if a pristine shell, i.e one
started with "env -i /path/to/shell" is allowed to set (initialize)
HOME. 2.5.3 on shell variables states,

   HOME
    The pathname of the user's home directory. The contents of HOME are
    used in tilde expansion (see Tilde Expansion).

For three other variables, the standard explicitly says "set by the shell",

   LINENO
    Set by the shell to a decimal number...
   PPID
    Set by the shell to the decimal process ID...
   PWD
    Set by the shell to be an absolute pathname...

But it does not explicitly say so for HOME. Different shells behave
differently, e.g on FreeBSD

	# env -i /bin/sh -c set | grep ^HOME=
	# env -i /usr/local/bin/bash -c set | grep ^HOME=
	# env -i /usr/local/bin/zsh -c set|grep ^HOME=
	HOME=/root
	# env -i /usr/local/bin/ksh93 -c set|grep ^HOME=
	# env -i /usr/local/bin/pdksh -c set|grep ^HOME=
	# env -i /bin/csh -c 'echo $HOME'   # = tcsh
	HOME: Undefined variable.

Is it okay for a shell to initialize HOME if it does not come in from
the inherited environment?

Regards,

	Jens
-- 
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)



Messages sorted by: Reverse Date, Date, Thread, Author