zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@hydra.ifh.de>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: zsh hangs on IRIX 5.2 / me to: (SunOS4.1.3 + Solaris 2.4)
Date: Mon, 25 Mar 1996 11:55:54 +0100	[thread overview]
Message-ID: <9603251055.AA15871@hydra.ifh.de> (raw)
In-Reply-To: "leibniz!stucki@leibniz.math.fu-berlin.de"'s message of "Fri, 22 Mar 1996 22:50:31 MET." <m0u0Eko-00080xC@leibniz.math.fu-berlin.de>

leibniz!stucki@leibniz.math.fu-berlin.de wrote:
> - BUT a zsh WAITING FOR A PROCESS TO COMPLETE,
>   RUNS FOREVER READING 'nothing' FROM STDIN
>   IF THE SUBPROCESS VANISHES AND
>   ZSH WAKES UP ON A 'DEAD' TTY.

I've been trying to reproduce this on our IRIX systems but have so far
failed; presumably there's another ingredient I haven't found (I can't
believe zsh's in Dahlem can be *that* different to those in Zeuthen,
or do we have to wait for Berlin-Brandenburg? -:)).

If you enter a sleep command and type more than 20 ^D's while you're
waiting for it to finish, the shell exits, as I would expect given the
current code.  Something funny must be happening when the tty goes
away which I don't understand.  The only things I can think of are (1)
that read() is returning `real' ^D's instead of simply a 0 from read,
which is very unlikely, or (2) that zle is not being used and the
error is somewhere else.  Here's the relevant code from the line
editor, in getkey(), zle_main.c, if anyone can think of anything.
It's been like this for some time.

(N.B.: the 20 maximum here is for ^D's typed while zsh wasn't looking
at input.  The 10 maximum applies if it was; the counter for that is
back in the main loop.)

You can at least see if this is the problem by removing the
`if (isset(IGNOREEOF)...) continue' and seeing if the problem goes
away.  That will have the side-effect that a ^D in typeahead will
cause the shell to exit.


while ((r = read(SHTTY, &cc, 1)) != 1) {
    if (r == 0) {
	/* The test for IGNOREEOF was added to make zsh ignore ^Ds
	   that were typed while commands are running.  Unfortuantely
	   this caused trouble under at least one system (SunOS 4.1).
	   Here shells that lost their xterm (e.g. if it was killed
	   with -9) didn't fail to read from the terminal but instead
	   happily continued to read EOFs, so that the above read
	   returned with 0, and, with IGNOREEOF set, this caused
	   an infinite loop.  The simple way around this was to add
	   the counter (icnt) so that this happens 20 times and than
	   the shell gives up (yes, this is a bit dirty...). */
	if (isset(IGNOREEOF) && icnt++ < 20)
	    continue;
	stopmsg = 1;
	zexit(1);
    }
    icnt = 0;
    if (errno == EINTR) {
	die = 0;
	if (!errflag)
	    continue;
	errflag = 0;
	errno = old_errno;
	return EOF;
    } else if (errno == EWOULDBLOCK) {
	fcntl(0, F_SETFL, 0);
    } else if (errno == EIO && !die) {
	ret = jobbingv;
	jobbingv = OPT_SET;
	attachtty(mypgrp);
	refresh();	/* kludge! */
	jobbingv = ret;
	die = 1;
    } else if (errno != 0) {
	zerr("error on TTY read: %e", NULL, errno);
	stopmsg = 1;
	zexit(1);
    }
}

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



  reply	other threads:[~1996-03-25 11:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-22 21:13 zsh hangs on IRIX 5.2 Achim Braemer
1996-03-22 21:50 ` zsh hangs on IRIX 5.2 / me to: (SunOS4.1.3 + Solaris 2.4) leibniz!stucki
1996-03-25 10:55   ` Peter Stephenson [this message]
1996-03-26 11:32     ` Achim Braemer
1996-03-26 12:43       ` Bas V. de Bakker
1996-03-26 18:19         ` Achim Braemer
1996-03-26 18:45           ` Zefram
1996-03-26 19:52             ` Barton E. Schaefer
1996-03-27  8:24               ` Peter Stephenson
1996-03-27 16:45                 ` Achim Braemer
     [not found] ` <m0u0Ej9-00080xC@leibniz.math.fu-berlin.de>
1996-03-22 22:12   ` Achim Braemer

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=9603251055.AA15871@hydra.ifh.de \
    --to=pws@hydra.ifh.de \
    --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).