zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@ny.frontiercomm.net>
To: zsh-workers@math.gatech.edu (Zsh hacking and development)
Subject: Re: stopping "wait" in (sub)script ?
Date: Thu, 15 May 1997 03:27:14 -0400 (EDT)	[thread overview]
Message-ID: <199705150727.DAA03178@hzoli.home> (raw)
In-Reply-To: <199705140900.LAA27708@hydra.ifh.de> from Peter Stephenson at "May 14, 97 11:00:08 am"

> > 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)


  reply	other threads:[~1997-05-15  7:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <33797750.316A@ptc.com>
1997-05-14  9:00 ` Peter Stephenson
1997-05-15  7:27   ` Zoltan Hidvegi [this message]
1997-05-15  9:07     ` Peter Stephenson
1997-05-15 10:52       ` Bart Schaefer
1997-05-15 15:47         ` Zoltan Hidvegi
1997-05-16  7:11           ` Zoltan Hidvegi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199705150727.DAA03178@hzoli.home \
    --to=hzoli@ny.frontiercomm.net \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).