unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Platon Pronko <platon7pronko@gmail.com>
To: 34821@debbugs.gnu.org
Subject: bug#34821: discard_input_tty does not discard pending input, resulting in garbage inserted into the buffer
Date: Sun, 7 Apr 2019 20:14:21 +0300	[thread overview]
Message-ID: <492c723c-6ba9-24da-108f-b25cef0dd54e@gmail.com> (raw)
In-Reply-To: <83v9zp93gq.fsf@gnu.org>

I guess that something in (terminal-init-xterm) hooks results in some buffer switch event being fired, that triggers the second return from read_char(). But since (terminal-init-xterm) and read_key_sequence() run concurrently, we have a race condition - if the terminal responds quickly enough, second buffer switch does not trigger quick enough and this problem happens.

I verified this by adding (sleep-for 0.1) to (defun xterm--query) or (defun terminal-init-xterm) - this resulted in 100% reproduction of the bug (thanks for the directions, by the way - my hands already hurt after trying to trigger that 1-in-10 bug so many times).

Maybe trying to rely on terminal being slow with the response is not the best solution? Even if I find a cause of the buffer switch event, we won't have a way to ensure that it always arrives before the response to SDA query (because multithreading).






  reply	other threads:[~2019-04-07 17:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12  7:53 bug#34821: discard_input_tty does not discard pending input, resulting in garbage inserted into the buffer Platon Pronko
2019-03-13  8:04 ` Platon Pronko
2019-04-07 16:06 ` Platon Pronko
2019-04-07 16:37   ` Eli Zaretskii
2019-04-07 17:14     ` Platon Pronko [this message]
2019-04-07 18:24       ` Eli Zaretskii
2019-04-07 19:06         ` Platon Pronko
2019-04-07 19:25           ` Eli Zaretskii
2020-05-24  6:23             ` Platon Pronko
2020-05-24  7:08               ` Stefan Kangas

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=492c723c-6ba9-24da-108f-b25cef0dd54e@gmail.com \
    --to=platon7pronko@gmail.com \
    --cc=34821@debbugs.gnu.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.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).