Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: SHELL not always correct
- X-seq: zsh-users 13363
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: SHELL not always correct
- Date: Tue, 21 Oct 2008 16:13:23 -0700
- Cc: dqarras@xxxxxxxxx, ZSH Users <zsh-users@xxxxxxxxxx>, pws@xxxxxxxxxxxxxxxxxxx
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200807; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=mbJN69LHkBT4Xbx6AFw/6xXOeZFMZtqBh6GmV2g1I0R5BSTP8I34o81B3Yg/TccleqQ6nuF9flswbfsjncdk5vxA8iJ5OM98ipsTFaVFq8LW7Eqq0HA8B5Q6ntfW+wLDwpKHufH6JpRDpMQ21GLyTKLrEv7uNA7K0RVad0RmerQ=;
- In-reply-to: <200810212058.m9LKwXQe009278@xxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, dqarras@xxxxxxxxx, ZSH Users <zsh-users@xxxxxxxxxx>, pws@xxxxxxxxxxxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <903527.44182.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <200810212058.m9LKwXQe009278@xxxxxxxxxxxxxxxxxxx>
On 2008-10-21 at 21:58 +0100, Peter Stephenson wrote:
> I very much doubt whether bash is altering SHELL internally; try
> starting with -x to see if it's coming from an initialisation file.
I don't want to read the bash source and end up with tainted knowledge
or whatever the term is, but this seems safe enough:
# cd /usr/ports/shells/bash
# make extract
# fgrep -r '"SHELL"' work
work/bash-3.2/variables.c: temp_var = find_variable ("SHELL");
work/bash-3.2/variables.c: temp_var = bind_variable ("SHELL", current_user.shell, 0);
work/bash-3.2/shell.c: set_var_read_only ("SHELL");
Okay, I peeked at variables.c and this comment:
/* Set $SHELL to the user's login shell if it is not already set. Call
get_current_user_info if we haven't already fetched the shell. */
decorates set_shell_var() which forcibly claims SHELL for itself.
Seems rather presumptuous, to claim to child processes that you are the
user's chosen preferred shell, merely because you're running.
Single Unix Specification v3, XBD, Chapter 8:
----------------------------8< cut here >8------------------------------
SHELL
This variable shall represent a pathname of the user's preferred
command language interpreter. If this interpreter does not conform
to the Shell Command Language in the Shell and Utilities volume of
IEEE Std 1003.1-2001, Chapter 2, Shell Command Language, utilities
may behave differently from those described in IEEE Std 1003.1-2001.
----------------------------8< cut here >8------------------------------
which is consistent with my understanding that programs setting up an
environment based on getpwnam() may set $SHELL (login, sshd, crontab) or
a user may set it themselves but it shouldn't be otherwise overriden
without good cause. Good cause might be a build system which wants to
guarantee POSIX sh instead of csh might set SHELL for the environment of
the build to get a known-good setup.
(I'm sure Peter knows all that, I'm answering the OP).
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author