From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21225 invoked from network); 12 Feb 2000 12:17:55 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Feb 2000 12:17:55 -0000 Received: (qmail 20763 invoked by alias); 12 Feb 2000 12:17:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9692 Received: (qmail 20754 invoked from network); 12 Feb 2000 12:17:46 -0000 Date: Sat, 12 Feb 2000 23:17:41 +1100 From: Geoff Wing To: Bart Schaefer Cc: zsh-workers@sunsite.auc.dk Subject: PATCH: 3.1.6-dev-17 (Was: BUG: backgrounding zsh does bad tty stuff) Message-ID: <20000212231741.A20778@primenet.com.au> References: <1000212055846.ZM6576@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <1000212055846.ZM6576@candle.brasslantern.com>; from schaefer@candle.brasslantern.com on Sat, Feb 12, 2000 at 05:58:46AM +0000 Organization: PrimeNet Computer Consultancy Bart Schaefer wrote about Re: BUG: backgrounding zsh does bad tty stuff: :On Feb 12, 5:03am, Geoff Wing wrote: :} Subject: BUG: backgrounding zsh does bad tty stuff :} % zsh-3.0.7 -f :} % echo $SHLVL :} 2 :} % zsh-3.0.7 -f & :} [1] 19784 : :I immediately get :[1] + suspended (tty output) zsh -f :What operating system are you using? NetBSD/i386 (current) :However, what did you expect? I expected to get what you got. :There's even a loop in init.c:init_io() where zsh repeatedly attempts to :force itself to be the tty foreground process, sending the pgrp leader :a SIGTTIN and then attempting to grab the tty. Not pretty, but it has :been there for a very long time. Yes, since 2.2. Note that bash (2.03) has something similar but bash still works properly. My problem is that zsh gets past that loop when it should be stuck there. This seems to fix it for me: we shouldn't be making ourself the process group leader for the terminal until our parent has told has we're really the process group leader. Also, I don't know why the sleep(1) is in there. It should hang on the killpg() - though it may be needed to compensate for some other weird occurrence and possibly shouldn't be taken out? *** Src/init.c.org Tue Jan 25 06:25:59 2000 --- Src/init.c Sat Feb 12 23:13:02 2000 *************** *** 394,403 **** #ifdef JOB_CONTROL /* If interactive, make the shell the foreground process */ if (opts[MONITOR] && interact && (SHTTY != -1)) { - attachtty(GETPGRP()); if ((mypgrp = GETPGRP()) > 0) { while ((ttpgrp = gettygrp()) != -1 && ttpgrp != mypgrp) { - sleep(1); mypgrp = GETPGRP(); if (mypgrp == gettygrp()) break; --- 394,401 ---- *************** *** 408,413 **** --- 406,412 ---- opts[MONITOR] = 0; } else opts[MONITOR] = 0; + attachtty(GETPGRP()); #else opts[MONITOR] = 0; #endif -- Geoff Wing : Work URL: http://www.primenet.com.au/ Rxvt Stuff : Ego URL : http://pobox.com/~gcw/ Zsh Stuff : Phone : (Australia) 0413 431 874