zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh workers <zsh-workers@zsh.org>
Subject: Re: Confirming X02zlevi test failures
Date: Wed, 19 Nov 2014 22:20:19 -0800	[thread overview]
Message-ID: <141119222019.ZM2717@torch.brasslantern.com> (raw)
In-Reply-To: <11014.1416438322@quattro>

On Nov 20, 12:05am, Oliver Kiddle wrote:
}
} While it is not the feature that test is there to test, it'd really be
} better to understand why KEYTIMEOUT isn't working in the test cases.

I instrumented raw_getbyte() and calc_timeout().  Found a couple of
things.

One, there's still a race condition with the PTY.  In random cases,
the cursor motion output that's sent by ZLE can be seen by the slave
PTY as if it were input from the master PTY:

0 0 88	<- first time into calc_timeout(), no timeout, 88 is garbage
^[	<- saw the escape character
1 1 1	<- we should time out in 1/100th second
^H	<- OOPS!  Read the backspace (output) as input?!
~	<- And there's the tilde

The second thing I found is that, possibly for the same reason, the
delayzetterm flag is (inconsistently in terms of zletest input, but
consistently for this particular test) getting set, which causes
KEYTIMEOUT to be ignored.  The comment for delayzetterm says:

         * 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() 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.

So ... for some reason zsetterm() believes that there is typeahead and
delays switching out of the canonical mode for too long.  This seems
to happen only when ESC is the first character written to the PTY, but
I'm not 100% sure of that.

Unfortunately, I don't know what to do about this, yet.  Thoughts?


  reply	other threads:[~2014-11-20  6:19 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 [this message]
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
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=141119222019.ZM2717@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).