GNU bug report logs - #34821
discard_input_tty does not discard pending input, resulting in garbage inserted into the buffer

Previous Next

Package: emacs;

Reported by: Platon Pronko <platon7pronko <at> gmail.com>

Date: Tue, 12 Mar 2019 08:10:01 UTC

Severity: normal

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 34821 <at> debbugs.gnu.org (full text, mbox):

From: Platon Pronko <platon7pronko <at> gmail.com>
To: 34821 <at> debbugs.gnu.org
Subject: Re: 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
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).





This bug report was last modified 4 years and 361 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.