From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3448 invoked from network); 22 Oct 2008 01:03:35 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 22 Oct 2008 01:03:35 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 74163 invoked from network); 22 Oct 2008 01:03:24 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 22 Oct 2008 01:03:24 -0000 Received: (qmail 23601 invoked by alias); 22 Oct 2008 01:02:49 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 13366 Received: (qmail 23573 invoked from network); 22 Oct 2008 01:02:44 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 22 Oct 2008 01:02:44 -0000 Received: from mx.spodhuis.org (redoubt.spodhuis.org [193.202.115.177]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 3AE8480524C0 for ; Wed, 22 Oct 2008 03:02:39 +0200 (CEST) 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=D7kqj0dXD+lIYdeJva7+mMunxGQk4EJPnhMxENmxCnlDc4FwdH6+wyCCzknpbHwardL+OwYBhpmhp5p13V88p5OvmNcBqBzgEfHSWB17UL/G+X16xH8K85AkLixUhPpeyDwcE0WiyQovuQsaiZfjPpnTr/P0/X7L4x6N9uwdYVc=; Received: by smtp.spodhuis.org with local id 1KsS7S-000Ku8-Ek; Wed, 22 Oct 2008 01:02:38 +0000 Date: Tue, 21 Oct 2008 18:02:38 -0700 From: Phil Pennock To: Aaron Davies Cc: Peter Stephenson , dqarras@yahoo.com, ZSH Users , pws@pws-pc.ntlworld.com Subject: Re: SHELL not always correct Message-ID: <20081022010238.GA67180@redoubt.spodhuis.org> Mail-Followup-To: Aaron Davies , Peter Stephenson , dqarras@yahoo.com, ZSH Users , pws@pws-pc.ntlworld.com References: <903527.44182.qm@web36808.mail.mud.yahoo.com> <200810212058.m9LKwXQe009278@pws-pc.ntlworld.com> <20081021231323.GA89901@redoubt.spodhuis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Virus-Scanned: ClamAV 0.92.1/8465/Tue Oct 21 22:14:56 2008 on bifrost X-Virus-Status: Clean On 2008-10-22 at 08:35 +0800, Aaron Davies wrote: > On Wed, Oct 22, 2008 at 7:13 AM, Phil Pennock > wrote: > > > Seems rather presumptuous, to claim to child processes that you are the > > user's chosen preferred shell, merely because you're running. > > I've generally found that SHELL isn't much use for figuring out what you're in. Never has been. Used to be that $0 was a good check and if $0 was unset then you're in csh. Nowadays with /bin/sh being a symlink to some other shell and sometimes needing to figure out what /bin/sh is that's more interesting. But anyone thinking $SHELL is the current shell is misunderstanding; $SHELL is a statement of desired intent, not of current state. It can be set by something conveying desired intent (ie, it looked in system databases such as /etc/passwd), by the user themselves or by someone needing to override desired intent for a process sub-tree, but shouldn't be being set by a shell for its children just because it's running. This actually appears to be a bash bug, as it means that on systems where /bin/sh is bash, programs using popen()/system()/etc will lose information about the user's configuration and even if zsh is the shell in /etc/passwd, programs run via such a path won't see it. Unless bash only calls this logic for interactive shells, that is. Figuring that out would involve reading enough of the bash source that someone might object to the reader then contributing to a non-GPL shell such as zsh. :-( I don't believe I currently have access to any systems using bash as /bin/sh to test the actual behaviour; they're all either using BSD sh or dash or equivalent. Or in a production environment where I really am not going to run private tests. -Phil