From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13614 invoked from network); 25 Feb 2003 03:37:18 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 25 Feb 2003 03:37:18 -0000 Received: (qmail 29278 invoked by alias); 25 Feb 2003 03:37:11 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18287 Received: (qmail 29271 invoked from network); 25 Feb 2003 03:37:11 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 25 Feb 2003 03:37:11 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [216.27.190.146] by sunsite.dk (MessageWall 1.0.8) with SMTP; 25 Feb 2003 3:37:11 -0000 Received: from ceramic.fifi.org (mail@ceramic.fifi.org [216.27.190.147]) by tantale.fifi.org (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id TAA06069; Mon, 24 Feb 2003 19:37:08 -0800 Received: from phil by ceramic.fifi.org with local (Exim 3.35 #1 (Debian)) id 18nVtz-0001rn-00; Mon, 24 Feb 2003 19:37:07 -0800 To: Peter Whaite Cc: zsh-workers@sunsite.dk Subject: Re: Cant fg a suspended su (4.1.0-dev-7) References: <200302250300.h1P30n621369@aragorn.cortexmachina.com> From: Philippe Troin Date: 24 Feb 2003 19:37:07 -0800 In-Reply-To: <200302250300.h1P30n621369@aragorn.cortexmachina.com> Message-ID: <87y945yqsc.fsf@ceramic.fifi.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: Philippe Troin Peter Whaite writes: > Philippe Troin said: > > > > A few questions for Peter: > > > > - Which su are you using? GNU su, the shadow utilities's version of > > su or something else? > > % ls -l =su > -rwsr-xr-x 1 root root 14112 Jan 16 2001 /bin/su* > % /bin/su --version > > su (GNU sh-utils) 2.0 > Written by David MacKenzie. > > Copyright (C) 1999 Free Software Foundation, Inc. Using the shadow utilities' su here... That's why I could not reproduce the problem. > > - Can you send us the output of 'ps xajf' ran from within the su > > shell... You might want to trim it. I'm interested in the PGID of > > the the su'ed zsh and its parent... For me it looks like this: 8< snip >8 > > % /bin/su peta > Password: > % ps xajf > > PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND > 20712 20728 20728 20728 pts/2 21112 S 501 0:00 | \_ zsh > 20728 21091 21091 20728 pts/2 21112 S 0 0:00 | \_ /bin/su > 21091 21095 21095 20728 pts/2 21112 S 501 0:00 | \_ zsh > 21095 21112 21112 20728 pts/2 21112 R 501 0:00 | \_ Now I know what the problem is... GNU su does not exec() the sub-shell and hangs around. The zsh-workers/17859 patch (which I'm responsible for) explicitly makes sure zsh is its own process group leader for interactive sessions. This cures quite a few problems but introduced this bug. Before zsh-workers/17859 was applied: the upper zsh would have had its own process group both su and the lower zsh share their process group Pros: suspend (as coded currently) works Cons: terminal-related signals get sent to both su and zsh. Su must contain special logic to ignore these signals, otherwise a (eg.) CTRL-C will kill the su process leaving the lower zsh completely disconnected from the upper zsh, which leads to chaos. After zsh-workers/17859 was applied: the upper zsh would have had its own process group su has its own process group at startup, zsh creates its own process group Pros: no need to add some special logic to su (or any other application) Cons: suspend (as currently coded) does not work. > and also (leftovers?)... 8< snip >8 Not needed. > I can confirm that it doesnt always happen. On a FreeBSD system this > version of su > > $FreeBSD: src/usr.bin/su/su.c,v 1.34.2.3 2001/08/17 15:44:42 ru Exp $ > > works fine. Probably because FreeBSD's su does exec() on $SHELL (shadow su's behavior) rather than fork()+exec() (GNU su behavior). > Hope this helps It did. I'll check out how the other shells (bash and tcsh) handle this case and will post a patch for bin_suspend() later. Phil.