GNU bug report logs - #78899
30.1; garbage inserted in the terminal buffer when quitting Emacs

Previous Next

Package: emacs;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Thu, 26 Jun 2025 00:39:01 UTC

Severity: normal

Found in version 30.1

To reply to this bug, email your comments to 78899 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#78899; Package emacs. (Thu, 26 Jun 2025 00:39:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vincent Lefevre <vincent <at> vinc17.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 26 Jun 2025 00:39:02 GMT) Full text and rfc822 format available.

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

From: Vincent Lefevre <vincent <at> vinc17.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.1; garbage inserted in the terminal buffer when quitting Emacs
Date: Thu, 26 Jun 2025 02:37:58 +0200
I ran "emacs -nw some_file" on my Android phone via ssh in xterm,
where emacs is provided by Termux.

Just after I quit Emacs with C-x C-c, I got the following in the
terminal buffer, which became input at the shell prompt:

^[[<35;42;25M35;40;24M35;37;24M35;42;25M35;33;23M

I think that this was the first time this occurred.

Note that there were no issues with the network (this is on the
local network at home).

In GNU Emacs 30.1 (build 1, aarch64-unknown-linux-android) of 2025-06-18
 built on localhost
Configured using:
 'configure --disable-dependency-tracking
 --prefix=/data/data/com.termux/files/usr
 --libdir=/data/data/com.termux/files/usr/lib
 --includedir=/data/data/com.termux/files/usr/include
 --sbindir=/data/data/com.termux/files/usr/bin --disable-rpath
 --disable-rpath-hack --host=aarch64-linux-android --disable-autodepend
 --with-dumping=none --with-gif=no --with-gnutls --with-jpeg=no
 --with-modules --with-pdumper=yes --with-png=no --with-tiff=no
 --with-xml2 --with-xpm=no --with-tree-sitter --without-dbus
 --without-gconf --without-gsettings --without-lcms2 --without-selinux
 --without-x emacs_cv_alternate_stack=yes emacs_cv_sanitize_address=yes
 emacs_cv_prog_cc_no_pie=no ac_cv_lib_elf_elf_begin=no
 gl_cv_func_dup2_works=no ac_cv_func_setrlimit=no --disable-nls
 --enable-shared --enable-static
 --libexecdir=/data/data/com.termux/files/usr/libexec 'CFLAGS=
 -fstack-protector-strong -Oz' 'CPPFLAGS=
 -isystem/data/data/com.termux/files/usr/include/c++/v1
 -isystem/data/data/com.termux/files/usr/include'
 'LDFLAGS=-L/data/data/com.termux/files/usr/lib
 -Wl,-rpath=/data/data/com.termux/files/usr/lib -Wl,--enable-new-dtags
 -Wl,--as-needed -Wl,-z,relro,-z,now''

Configured features:
GMP GNUTLS LIBXML2 MODULES NOTIFY INOTIFY PDUMPER SECCOMP SQLITE3
THREADS TREE_SITTER XIM ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  display-time-mode: t
  xterm-mouse-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr cl-extra help-mode tool-bar warnings icons
emacsbug message mailcap yank-media puny dired dnd dired-loaddefs rfc822
mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util
text-property-search time-date subr-x mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils vc-dispatcher vc-svn
term/xterm xterm byte-opt gv bytecomp byte-compile time image cus-load
cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt cl-loaddefs
cl-lib xt-mouse rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode tabulated-list
replace newcomment text-mode lisp-mode prog-mode register page tab-bar
menu-bar rfn-eshadow isearch easymenu timer select mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads inotify
multi-tty make-network-process emacs)

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78899; Package emacs. (Thu, 26 Jun 2025 06:19:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Vincent Lefevre <vincent <at> vinc17.net>, Po Lu <luangruo <at> yahoo.com>
Cc: 78899 <at> debbugs.gnu.org
Subject: Re: bug#78899: 30.1;
 garbage inserted in the terminal buffer when quitting Emacs
Date: Thu, 26 Jun 2025 09:18:45 +0300
> Date: Thu, 26 Jun 2025 02:37:58 +0200
> From: Vincent Lefevre <vincent <at> vinc17.net>
> 
> I ran "emacs -nw some_file" on my Android phone via ssh in xterm,
> where emacs is provided by Termux.
> 
> Just after I quit Emacs with C-x C-c, I got the following in the
> terminal buffer, which became input at the shell prompt:
> 
> ^[[<35;42;25M35;40;24M35;37;24M35;42;25M35;33;23M
> 
> I think that this was the first time this occurred.
> 
> Note that there were no issues with the network (this is on the
> local network at home).

That could be some kind of command we send to the terminal, which the
terminal doesn't support?

Po Lu, any ideas?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78899; Package emacs. (Thu, 26 Jun 2025 11:38:02 GMT) Full text and rfc822 format available.

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

From: Pip Cet <pipcet <at> protonmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Po Lu <luangruo <at> yahoo.com>, 78899 <at> debbugs.gnu.org,
 Vincent Lefevre <vincent <at> vinc17.net>
Subject: Re: bug#78899: 30.1;
 garbage inserted in the terminal buffer when quitting Emacs
Date: Thu, 26 Jun 2025 11:37:12 +0000
"Eli Zaretskii" <eliz <at> gnu.org> writes:

>> Date: Thu, 26 Jun 2025 02:37:58 +0200
>> From: Vincent Lefevre <vincent <at> vinc17.net>
>>
>> I ran "emacs -nw some_file" on my Android phone via ssh in xterm,
>> where emacs is provided by Termux.
>>
>> Just after I quit Emacs with C-x C-c, I got the following in the
>> terminal buffer, which became input at the shell prompt:
>>
>> ^[[<35;42;25M35;40;24M35;37;24M35;42;25M35;33;23M
>>
>> I think that this was the first time this occurred.
>>
>> Note that there were no issues with the network (this is on the
>> local network at home).
>
> That could be some kind of command we send to the terminal, which the
> terminal doesn't support?
>
> Po Lu, any ideas?

Those are mouse movements reported by xterm.  I can reproduce this by
using a slow connection, enabling xterm-mouse-mode, quitting Emacs, and
moving the mouse while that process is being sent.

I think what happens is that we send the escape sequence to disable
those just before exiting, without waiting for that escape sequence to
be processed by the terminal, so xterm keeps sending them to the next
application for a while.

Note that xterm--query-name-and-version fails on slow connections, too:
the timeout is set to 0.1 s, and if we don't get a response in that time,
we get an asynchronous throw to a tag that no longer has a catch.  This
produces the error message:

No catch for tag: result, "XTerm(400)"

IIUC, the xterm--query-name-and-version bug hides the other bug:
usually, if you have a slow connection, xterm mouse mode won't be
enabled automatically because we fail to recognize the terminal.  If you
have a fast connection, such as a local display, the window for mouse
movements to be reported is small.

We could possibly fix this by asking for another report from xterm upon
termination and waiting for the response?

Pip





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78899; Package emacs. (Thu, 26 Jun 2025 12:36:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Pip Cet <pipcet <at> protonmail.com>
Cc: luangruo <at> yahoo.com, 78899 <at> debbugs.gnu.org, vincent <at> vinc17.net
Subject: Re: bug#78899: 30.1;
 garbage inserted in the terminal buffer when quitting Emacs
Date: Thu, 26 Jun 2025 15:35:27 +0300
> Date: Thu, 26 Jun 2025 11:37:12 +0000
> From: Pip Cet <pipcet <at> protonmail.com>
> Cc: Vincent Lefevre <vincent <at> vinc17.net>, Po Lu <luangruo <at> yahoo.com>, 78899 <at> debbugs.gnu.org
> 
> We could possibly fix this by asking for another report from xterm upon
> termination and waiting for the response?

Yes, I think something like that would make sense.




This bug report was last modified 1 day ago.

Previous Next


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