zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: Re: A05 Test Hang
Date: Mon, 26 Jan 2015 08:35:25 -0800	[thread overview]
Message-ID: <150126083525.ZM31610@torch.brasslantern.com> (raw)
In-Reply-To: <CAECNH1TA6JvAf49bs1AxWMneqQkZbyS97U_AFGGoi1wpDwwtgg@mail.gmail.com>

On Jan 26, 10:09am, Peter Stephenson wrote:
}
} I'm still scratching my head over how it hung permanently,

When polltty() is true, we call gettyinfo() and settyinfo() even if
the file descriptor has nothing to do with a tty.  The settyinfo()
triggers a SIGTTOU which stops the whole process group.

} but it must be something to do with using terminal input mode
} when we shouldn't be.  So I suppose that's not particularly
} suspicious beyond the bug,but I can't quite convince myself...

Comments in read_poll() seem to indicate that polltty is only needed
as some kind of workaround for Cygwin.  It could probably be combined
with an isatty() test, or possibly even replaced by one.

(Indentation was 5 spaces instead of 4 for those two lines, emacs
fixed it for me.)

diff --git a/Src/utils.c b/Src/utils.c
index d38babb..47d9944 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2300,8 +2300,8 @@ read_poll(int fd, int *readchar, int polltty, zlong microseconds)
     struct ttyinfo ti;
 #endif
 
-     if (fd < 0)
-	 polltty = 0;		/* no tty to poll */
+    if (fd < 0 || (polltty && !isatty(fd)))
+	polltty = 0;		/* no tty to poll */
 
 #if defined(HAS_TIO) && !defined(__CYGWIN__)
     /*


  reply	other threads:[~2015-01-26 16:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 21:28 Vin Shelton
2015-01-25 23:51 ` Bart Schaefer
2015-01-26  0:01   ` Bart Schaefer
2015-01-26 10:09     ` Peter Stephenson
2015-01-26 16:35       ` Bart Schaefer [this message]
2015-01-26 16:40         ` Peter Stephenson

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=150126083525.ZM31610@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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).