From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14966 invoked from network); 15 Jun 1998 15:57:13 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 15 Jun 1998 15:57:13 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id LAA14155; Mon, 15 Jun 1998 11:51:59 -0400 (EDT) Resent-Date: Mon, 15 Jun 1998 11:51:59 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980615085238.ZM4667@candle.brasslantern.com> Date: Mon, 15 Jun 1998 08:52:38 -0700 In-Reply-To: <199806151428.PAA10680@taos.demon.co.uk> Comments: In reply to Zefram "Re: Wrong emulation mode if exec'd by su" (Jun 15, 3:28pm) References: <199806151428.PAA10680@taos.demon.co.uk> X-Mailer: Z-Mail (5.0.0 30July97) To: Zefram , zsh-workers@math.gatech.edu Subject: Re: Wrong emulation mode if exec'd by su Cc: aumuelle@mi.uni-erlangen.de MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"C-3Xu1.0.3T3.UCKXr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4122 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Jun 15, 3:28pm, Zefram wrote: } Subject: Re: Wrong emulation mode if exec'd by su } } The original behaviour is correct. "su" really should not give the shell } this weird argv[0] (some versions don't). But on the older systems where } it does, it's more likely that the shell being invoked is supposed to } be sh, so treating a name of "su" as "sh" is the best behaviour. For plain "su", I mostly agree. For "su -" it's the user's login shell that is supposed to be invoked. (I suspect the reason for the "weird" $0 is so that it will show up in "ps" even after exec()ing the real shell.) However, the fix in the patch is the wrong one. Rather than looking for every possible shell name in argv[0], the right thing would be to look for "su" in argv[0], before testing the first letter for emulation, and in that case do the emulation test on the value of $SHELL rather than on argv[0]. I'm short of time this morning, but if that seems reasonable and no one else does it first I may make a patch later today. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com