zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Confirming X02zlevi test failures
Date: Wed, 26 Nov 2014 15:51:19 +0100	[thread overview]
Message-ID: <30162.1417013479@thecus.kiddle.eu> (raw)
In-Reply-To: <C097A9C2-C61C-482C-BEDA-94736DE7C5DB@kba.biglobe.ne.jp>

"Jun T." wrote:
> commit c4110f7f4eac347fdbce71c286659a77beb138f7 added a workaround
> to Test/comptest, but for the test to succeed on my Mac the line
> zpty_flush After zletest
> must also be commented out.
> But even this is not enough, as reported below:

Sorry, I interpreted 33765 (and my own test results) to indicate that
this was fairly reliable. And I wasn't making much progress on a
non-workaround fix myself.

I'm fairly stuck as far as this issue goes. The test input is clearly
being handled with the default (shttyinfo and ICANON) terminal settings
in force but the terminal settings seem to get set and unset all over
the place.

The delayzsetterm stuff is not related. Digging through the history
shows that the "some systems" on which the workaround was needed are
DG/UX and Ultrix. Any objections to just ripping this out as per the
patch below?

Oliver


diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index a38f55b..caa052b 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -187,10 +187,6 @@ mod_export char *zlenoargs[1] = { NULL };
 
 static char **raw_lp, **raw_rp;
 
-#ifdef FIONREAD
-static int delayzsetterm;
-#endif
-
 /*
  * File descriptors we are watching as well as the terminal fd. 
  * These are all for reading; we don't watch for writes or exceptions.
@@ -210,9 +206,6 @@ mod_export void
 zsetterm(void)
 {
     struct ttyinfo ti;
-#if defined(FIONREAD)
-    int val;
-#endif
 
     if (fetchttyinfo) {
 	/*
@@ -224,30 +217,6 @@ zsetterm(void)
 	fetchttyinfo = 0;
     }
 
-#if defined(FIONREAD)
-    ioctl(SHTTY, FIONREAD, (char *)&val);
-    if (val) {
-	/*
-	 * Problems can occur on some systems when switching from
-	 * canonical to non-canonical input.  The former is usually
-	 * set while running programmes, but the latter is necessary
-	 * for zle.  If there is input in canonical mode, then we
-	 * need to read it without setting up the terminal.  Furthermore,
-	 * while that input gets processed there may be more input
-	 * being typed (i.e. further typeahead).  This means that
-	 * we can't set up the terminal for zle *at all* until
-	 * we are sure there is no more typeahead to come.  So
-	 * if there is typeahead, we set the flag delayzsetterm.
-	 * Then getbyte() calls here to performs another FIONREAD call;
-	 * if that is 0, we have finally used up all the typeahead, and
-	 * it is safe to alter the terminal, which we do at that point.
-	 */
-	delayzsetterm = 1;
-	return;
-    } else
-	delayzsetterm = 0;
-#endif
-
 /* sanitize the tty */
 #ifdef HAS_TIO
     shttyinfo.tio.c_lflag |= ICANON | ECHO;
@@ -343,7 +312,7 @@ zsetterm(void)
 	ti.ltchars.t_dsuspc = ti.ltchars.t_lnextc = -1;
 #endif
 
-#if defined(TTY_NEEDS_DRAINING) && defined(TIOCOUTQ) && defined(HAVE_SELECT)
+#if defined(TIOCOUTQ) && defined(HAVE_SELECT)
     if (baud) {			/**/
 	int n = 0;
 
@@ -541,11 +510,7 @@ raw_getbyte(long do_keytmout, char *cptr)
      * timeouts may be external, so we may have both a permanent watched
      * fd and a long-term timeout.
      */
-    if ((nwatch || tmout.tp != ZTM_NONE)
-#ifdef FIONREAD
-	&& ! delayzsetterm
-#endif
-	) {
+    if ((nwatch || tmout.tp != ZTM_NONE)) {
 #if defined(HAVE_SELECT) || defined(HAVE_POLL)
 	int i, errtry = 0, selret;
 # ifdef HAVE_POLL
@@ -883,10 +848,6 @@ getbyte(long do_keytmout, int *timeout)
     if (kungetct)
 	ret = STOUC(kungetbuf[--kungetct]);
     else {
-#ifdef FIONREAD
-	if (delayzsetterm)
-	    zsetterm();
-#endif
 	for (;;) {
 	    int q = queue_signal_level();
 	    dont_queue_signals();


  reply	other threads:[~2014-11-26 14:51 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19 16:50 Bart Schaefer
2014-11-19 17:25 ` Ray Andrews
2014-11-19 23:05 ` Oliver Kiddle
2014-11-20  6:20   ` Bart Schaefer
2014-11-20 15:42     ` Jun T.
2014-11-20 17:18       ` Bart Schaefer
2014-11-21 14:37         ` Oliver Kiddle
2014-11-21 18:18         ` Jun T.
2014-11-21 18:56           ` Bart Schaefer
2014-11-23  1:37             ` Jun T.
2014-11-23  3:32               ` Bart Schaefer
2014-11-23  7:44                 ` Jun T.
2014-11-24  0:11                   ` Bart Schaefer
2014-11-23  9:00               ` Oliver Kiddle
2014-11-23 18:37                 ` Bart Schaefer
2014-11-25 17:13         ` Jun T.
2014-11-25 17:32           ` Jun T.
2014-11-25 19:01             ` Bart Schaefer
2014-11-26  2:31               ` Jun T.
2014-11-26 14:51                 ` Oliver Kiddle [this message]
2014-11-26 15:45                   ` Peter Stephenson
2014-11-26 16:37                     ` Bart Schaefer
2014-11-27 14:11                       ` Oliver Kiddle
2014-12-01 10:58                         ` Jun T.
2014-12-05 14:36                           ` Oliver Kiddle

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=30162.1417013479@thecus.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --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).