From: Ryan Johnson <ryanjohn@ece.cmu.edu>
To: 7117@debbugs.gnu.org
Subject: bug#7117: 23.2.2 mangles terminal escape sequences
Date: Mon, 27 Sep 2010 14:10:29 +0200 [thread overview]
Message-ID: <4CA089B5.80601@ece.cmu.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 2557 bytes --]
Hi all,
Emacs-23.2 occasionally loses parts of terminal escape sequences,
confusing xt-mouse.el and dumping garbage text in the user's buffer.
Steps to reproduce:
1. ssh to a machine with emacs-23 installed (I suspect slower
networks would expose this more, but the bug bites me even over
intranet)
2. compile tee-input.c (see below) into a shared library (on solaris:
`cc -g -G -xcode=pic13 -ldl -hlibtee-input.so tee-input.c -g -o
libtee-input.so')
3. invoke `LD_PRELOAD=libtee-input.so emacs -nw -Q 2>input.txt'
4. M-x xterm-mouse-mode
5. flick the mouse scroll wheel hard, so it generates many ticks in
quick succession (note the garbage that results)
6. M-x show-lossage (note the mangled escape sequences)
7. C-x C-c
8. Examine input.txt (note the intact escape sequences)
Doing the above with emacs-22.3.1 always works fine, but emacs-23.2.2
mangles one or more escape sequences (input.txt is not corrupted). I
suspect this and bug #6920 are symptoms of the same problem.
The number of characters missing ranges from 1 (only ESC missing) to all
but one (only [ present); I don't think I've yet seen an entire sequence
disappear. The harder the flick the more numerous the mangled escape
sequences. It's not an OS issue because I can reproduce it on three very
different machines (32-bit cygwin, 64-bit redhat, 32-bit solaris). It's
also not a problem with the terminal because the intercepted input is
correct. Finally, it's not a problem with xt-mouse.el because
show-lossage is incorrect.
To give one example I generated using the above steps, emacs *scratch*
buffer shows:
`b[[M`b[
The output of show-lossage is (note the orphaned ` b [, and later the
orphaned [, and finally the orphaned M ` b [):
ESC [ > 7 7 ; 9 0 0 ; 0 c ESC x x t e r m - m o u s
e TAB RET ESC [ M ` b [ ` b [ ESC [ M ` b [ ESC [ M
` b [ ESC [ M ` b [ ESC [ M ` b [ ESC [ M ` b [ [ M
` b [ ESC [ M ` b [ ESC O P l
The relevant snippet of input.txt is:
;;;;;ESC[M`b[ESC[M`b[ESC[M`b[ESC[M`b[ESC[M`b[ESC[M`b[ESC[M`b[ESC[M`b[ESC[M`b[ESC[M`b[ESC[M`b[ESCOPl
Thoughts?
Ryan
===== tee-input.c ====
#include <dlfcn.h>
#include <unistd.h>
typedef ssize_t (*read_func)(int fildes, void *buf, size_t nbyte);
ssize_t read(int fildes, void *buf, size_t nbyte) {
static read_func old_read = 0;
if(!old_read)
old_read = (read_func) dlsym(RTLD_NEXT, "read");
ssize_t rval = old_read(fildes, buf, nbyte);
if(rval > 0)
write(2, buf, rval);
return rval;
}
=================
[-- Attachment #2: Type: text/html, Size: 3430 bytes --]
next reply other threads:[~2010-09-27 12:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-27 12:10 Ryan Johnson [this message]
2010-09-27 20:52 ` bug#7117: 23.2.2 mangles terminal escape sequences Stefan Monnier
2010-09-28 4:53 ` Ryan Johnson
2010-09-30 11:37 ` Ryan Johnson
2010-09-30 14:39 ` Ryan Johnson
2010-09-30 14:59 ` Eli Zaretskii
2010-09-30 15:14 ` Ryan Johnson
2010-09-30 15:44 ` Eli Zaretskii
2010-09-30 16:11 ` Ryan Johnson
2022-02-07 0:33 ` Lars Ingebrigtsen
2022-03-07 2:37 ` Lars Ingebrigtsen
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=4CA089B5.80601@ece.cmu.edu \
--to=ryanjohn@ece.cmu.edu \
--cc=7117@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.