unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7117: 23.2.2 mangles terminal escape sequences
@ 2010-09-27 12:10 Ryan Johnson
  2010-09-27 20:52 ` Stefan Monnier
  2022-02-07  0:33 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 11+ messages in thread
From: Ryan Johnson @ 2010-09-27 12:10 UTC (permalink / raw)
  To: 7117

[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-03-07  2:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-27 12:10 bug#7117: 23.2.2 mangles terminal escape sequences Ryan Johnson
2010-09-27 20:52 ` 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

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