From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5997 invoked from network); 15 May 1997 07:36:47 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 15 May 1997 07:36:47 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id DAA12569; Thu, 15 May 1997 03:24:37 -0400 (EDT) Resent-Date: Thu, 15 May 1997 03:24:37 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199705150727.DAA03178@hzoli.home> Subject: Re: stopping "wait" in (sub)script ? In-Reply-To: <199705140900.LAA27708@hydra.ifh.de> from Peter Stephenson at "May 14, 97 11:00:08 am" To: zsh-workers@math.gatech.edu (Zsh hacking and development) Date: Thu, 15 May 1997 03:27:14 -0400 (EDT) X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"HNKwn1.0.K43.pehUp"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3149 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > > I cannot stop such command > > > > $ for i in `cat ss` > > for> do xvi $i & > > for> wait > > for> done > > yup, same here on IRIX 5.3 with 3.1.2-test1. The `cat ss` is > definitely necessary, there is no problem if it's replaced by a simple > list of values. Weird. OK, now I got it. The fix looks really simple, and I do hope that this is really al that's needed. entersubshell changes the terminal process group to the subshell's newly created process group, and the main shell does not reattach the terminal after the foreground process exits. The simplest way to reproduce the bug is (:); while true; do; done Which causes an uninterruptible infinite loop. It is really surprising that this bug remained hidden for such a long time. An interactive shell always looses the terminal after executinh any foreground command, and it is only reattached when the hbegin is called to get the next line from the terminal. This was probably the reason that sometimes ^C did not interrupt loops started from an interactive shell. Zoltan *** Src/jobs.c 1997/05/09 04:55:51 3.1.2.3 --- Src/jobs.c 1997/05/15 06:57:44 *************** *** 156,161 **** --- 156,164 ---- pgrp = gettygrp(); /* get process group of tty */ + if (isset(MONITOR) && pgrp == jn->gleader) + attachtty(mypgrp); + /* is this job in the foreground of an interactive shell? */ if ((jn->gleader == pgrp || (pgrp > 1 && kill(-pgrp, 0) == -1)) && !ttyfrozen && !val && !jn->stty_in_env)