GNU bug report logs - #21041
24.3; emacsclient doesn't discover ansi-term correctly

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Sun, 12 Jul 2015 14:56:02 UTC

Severity: minor

Tags: fixed, patch

Merged with 22639

Found in versions 24.3, 24.5

Fixed in version 26.2

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21041 in the body.
You can then email your comments to 21041 AT debbugs.gnu.org in the normal way.

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#21041; Package emacs. (Sun, 12 Jul 2015 14:56:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Philipp Stephani <p.stephani2 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 12 Jul 2015 14:56:02 GMT) Full text and rfc822 format available.

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

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; emacsclient doesn't discover ansi-term correctly
Date: Sun, 12 Jul 2015 16:54:42 +0200
M-x ansi-term RET RET
emacsclient -t

Expected: emacsclient shows an error message
Actual: Emacs frame opened inside ansi-term

term.el sets TERM to eterm-color, but emacsclient.c checks only for
eterm (exact match).  I'd suggest to introduce more defensive checks in
emacsclient.c:  abort whenever either TERM starts with eterm (prefix
match) or INSIDE_EMACS is set.

This seems to be present in the emacsclient.c in head.


In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)
 of 2014-03-07 on lamiak, modified by Debian
System Description:	Ubuntu 14.04 LTS

Configured using:
 `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars'
 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 0 ; 2 5 6 ; 0 c ESC x t e r m DEL DEL DEL DEL 
a n s i - t e r m RET RET e m a c s c l i e n t SPC 
- t RET C-x 5 0 C-x C-c C-c C-x RET C-c C-x C-c C-c 
C-g C-c C-j ESC x k i l l RET b u f TAB RET RET y e 
s RET ESC x r e p o r t TAB RET

Recent messages:
("emacs")
For information about GNU Emacs and the GNU system, type C-h C-a.
call-interactively: Attempt to delete the sole visible or iconified frame
You can run the command `kill-buffer' with C-x k
error in process filter: read-event: Selecting deleted buffer
error in process filter: Selecting deleted buffer

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils term disp-table easymenu ehelp electric ring
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty emacs)

-- 
Google Germany GmbH
Dienerstraße 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Diese E-Mail ist vertraulich.  Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und löschen
Sie die E-Mail und alle Anhänge.  Vielen Dank.
       
This e-mail is confidential.  If you are not the right addressee please do not
forward it, please inform the sender, and please erase this e-mail including
any attachments.  Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21041; Package emacs. (Tue, 24 Jul 2018 01:21:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: 21041 <at> debbugs.gnu.org
Subject: Re: bug#21041: 24.3; emacsclient doesn't discover ansi-term correctly
Date: Mon, 23 Jul 2018 21:20:09 -0400
[Message part 1 (text/plain, inline)]
merge 21041 22639
tags 21041 + patch
quit

Philipp Stephani <p.stephani2 <at> gmail.com> writes:

> M-x ansi-term RET RET
> emacsclient -t
>
> Expected: emacsclient shows an error message
> Actual: Emacs frame opened inside ansi-term

And then gets stuck, as described in Bug#22639.

> term.el sets TERM to eterm-color, but emacsclient.c checks only for
> eterm (exact match).  I'd suggest to introduce more defensive checks in
> emacsclient.c:  abort whenever either TERM starts with eterm (prefix
> match) or INSIDE_EMACS is set.

I think "or" is too aggressive, "and" makes more sense.  "eterm" is
somewhat generic, there used to be a non-Emacs related terminal emulator
called that.

[0001-Fix-emacsclient-check-for-term.el-buffer-Bug-21041.patch (text/x-diff, inline)]
From d9d779ebe7d62e9ea928ead61a7c345f8eb2058a Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Mon, 23 Jul 2018 21:01:01 -0400
Subject: [PATCH] Fix emacsclient check for term.el buffer (Bug#21041)

* lib-src/emacsclient.c (find_tty): Check for any TERM value with
prefix of "eterm", not just "eterm" itself.  Also check for ",term:"
in INSIDE_EMACS value.
---
 lib-src/emacsclient.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index b139b2fe3f..b0243f99c2 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1114,7 +1114,9 @@ find_tty (const char **tty_type, const char **tty_name, int noabort)
 	}
     }
 
-  if (strcmp (type, "eterm") == 0)
+  const char *inside_emacs = egetenv ("INSIDE_EMACS");
+  if (inside_emacs && strstr (inside_emacs, ",term:")
+      && strprefix ("eterm", type))
     {
       if (noabort)
 	return 0;
-- 
2.11.0


Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 24 Jul 2018 01:21:03 GMT) Full text and rfc822 format available.

Forcibly Merged 21041 22639. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 24 Jul 2018 01:22:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#21041; Package emacs. (Wed, 08 Aug 2018 23:52:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: 21041 <at> debbugs.gnu.org
Subject: Re: bug#21041: 24.3; emacsclient doesn't discover ansi-term correctly
Date: Wed, 08 Aug 2018 19:51:06 -0400
tags 21041 fixed
close 21041 26.2
quit

> I think "or" is too aggressive, "and" makes more sense.  "eterm" is
> somewhat generic, there used to be a non-Emacs related terminal emulator
> called that.

Pushed to emacs-26.

[1: 5afbf62674]: 2018-08-08 19:29:59 -0400
  Fix emacsclient check for term.el buffer (Bug#21041)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5afbf62674e741b06c01216fe37a5439e9d42307




Added tag(s) fixed. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 08 Aug 2018 23:52:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.2, send any further explanations to 21041 <at> debbugs.gnu.org and Philipp Stephani <p.stephani2 <at> gmail.com> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 08 Aug 2018 23:52:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 06 Sep 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 291 days ago.

Previous Next


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