GNU bug report logs - #31326
eshell/clear goes into infinite loop with eshell-smart-initialize

Previous Next

Package: emacs;

Reported by: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>

Date: Tue, 1 May 2018 06:15:02 UTC

Severity: normal

Tags: confirmed, fixed, patch

Merged with 37198

Found in versions 25, 26.2, 27.0.50

Fixed in version 27.1

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 31326 in the body.
You can then email your comments to 31326 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#31326; Package emacs. (Tue, 01 May 2018 06:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 01 May 2018 06:15:02 GMT) Full text and rfc822 format available.

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

From: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Tue, 1 May 2018 01:08:20 -0500
The eshell/clear elisp function seems to go into an infinite loop before
ending in an error when the eshell smart display functionality is
enabled in eshell-mode-hook. Several "Error during redisplay" messages
are printed to *Messages* buffer.

Steps to reproduce:
1. ./emacs -Q
2. In the scratch buffer evaluate:
(require 'em-smart)
(add-hook 'eshell-mode-hook 'eshell-smart-initialize)
4. M-x eshell
5. type "clear" in eshell and press RET

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2018-04-29 built on jkmlaptop
Repository revision: bf12cc6c7830937b4c1a3df46294e74bea749a5f
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04 LTS

Recent messages:
Error during redisplay: (eval (if (frame-parameter nil 'client) "@" "")) 
signaled (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
Error during redisplay: (eval (unless (display-graphic-p) "-%-")) 
signaled (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
Error during redisplay: (#[128 "\300\301\"\210\300\302\"\207" [apply 
redisplay--pre-redisplay-functions ignore nil] 4 nil nil] (#<window 3 on 
*eshell*>)) signaled (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
Error during redisplay: (mode-line-default-help-echo #<window 3 on 
*eshell*>) signaled (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
Error during redisplay: (eval (if (display-graphic-p) " " "-")) signaled 
(error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
Error during redisplay: (eval (mode-line-eol-desc)) signaled (error 
"Lisp nesting exceeds ‘max-lisp-eval-depth’")
Error during redisplay: (eval (if (frame-parameter nil 'client) "@" "")) 
signaled (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
Error during redisplay: (eval (unless (display-graphic-p) "-%-")) 
signaled (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
redisplay--pre-redisplay-functions: (error "Lisp nesting exceeds 
‘max-lisp-eval-depth’")
Mark set
Quit
Configured using:
 'configure --with-modules'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Eshell

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-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

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils em-unix em-term term disp-table easymenu
ehelp em-script em-prompt em-ls cl-loaddefs cl-lib em-hist em-pred
em-glob em-dirs em-cmpl em-basic em-banner em-alias em-smart pcomplete
comint ansi-color ring esh-var esh-cmd esh-opt esh-io esh-ext esh-proc
esh-arg esh-groups eshell esh-module esh-util esh-mode time-date
elec-pair mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic 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 charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 114325 13958)
 (symbols 48 21764 1)
 (miscs 40 58 128)
 (strings 32 33419 2014)
 (string-bytes 1 930621)
 (vectors 16 17832)
 (vector-slots 8 529981 21864)
 (floats 8 61 176)
 (intervals 56 1335 0)
 (buffers 992 12))

-- 
Jonathan Kyle Mitchell





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31326; Package emacs. (Tue, 01 May 2018 12:22:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
Cc: 31326 <at> debbugs.gnu.org
Subject: Re: bug#31326: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Tue, 01 May 2018 08:21:20 -0400
[Message part 1 (text/plain, inline)]
retitle 31326 eshell/clear goes into infinite loop with eshell-smart-initialize
found 31326 25
tags 31326 + confirmed
quit

Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org> writes:

> The eshell/clear elisp function seems to go into an infinite loop before
> ending in an error when the eshell smart display functionality is
> enabled in eshell-mode-hook. Several "Error during redisplay" messages
> are printed to *Messages* buffer.
>
> Steps to reproduce:
> 1. ./emacs -Q
> 2. In the scratch buffer evaluate:
> (require 'em-smart)
> (add-hook 'eshell-mode-hook 'eshell-smart-initialize)
> 4. M-x eshell
> 5. type "clear" in eshell and press RET

This reproduces back to 25.3; it doesn't happen in 24.5, but "clear"
seems to do nothing in that version.  I caught a backtrace (attached)
with M-x toggle-debug-on-quit and quickly hitting C-g.

[bug-31326-eshell-smart-clear.backtrace.txt.gz (application/gzip, attachment)]

Changed bug title to 'eshell/clear goes into infinite loop with eshell-smart-initialize' from '27.0.50; eshell/clear exceeds max-lisp-eval-depth' Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 01 May 2018 12:22:02 GMT) Full text and rfc822 format available.

bug Marked as found in versions 25. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 01 May 2018 12:22:03 GMT) Full text and rfc822 format available.

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

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31326; Package emacs. (Thu, 03 May 2018 04:11:02 GMT) Full text and rfc822 format available.

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

From: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
To: 31326 <at> debbugs.gnu.org, npostavs <at> gmail.com
Subject: Re: bug#31326: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Wed, 2 May 2018 23:09:55 -0500

On 05/01/2018 07:21 AM, Noam Postavsky wrote:
> retitle 31326 eshell/clear goes into infinite loop with eshell-smart-initialize
> found 31326 25
> tags 31326 + confirmed
> quit
>
> Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org> writes:
>
>> The eshell/clear elisp function seems to go into an infinite loop before
>> ending in an error when the eshell smart display functionality is
>> enabled in eshell-mode-hook. Several "Error during redisplay" messages
>> are printed to *Messages* buffer.
>>
>> Steps to reproduce:
>> 1. ./emacs -Q
>> 2. In the scratch buffer evaluate:
>> (require 'em-smart)
>> (add-hook 'eshell-mode-hook 'eshell-smart-initialize)
>> 4. M-x eshell
>> 5. type "clear" in eshell and press RET
> This reproduces back to 25.3; it doesn't happen in 24.5, but "clear"
> seems to do nothing in that version.  I caught a backtrace (attached)
> with M-x toggle-debug-on-quit and quickly hitting C-g.
>

I did a little more investigation into this issue. While I don't fully 
understand all the code paths of how it works, I found that let binding 
eshell-input-filter-functions to nil stops the infinite looping.

Before issuing the clear command in eshell, 
eshell-input-filter-functions contains this list:
    (eshell-smart-display-setup eshell-add-to-history)

The original eshell/clear implementation just removes 
eshell-add-to-history, so eshell-input-filter-functions is just this 
list (which results in infinite looping):
    (eshell-smart-display-setup)

Here's a diff for the change that works for me:

diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index bbb74c3d86..9f854c7d90 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -884,8 +884,7 @@ eshell/clear
   (interactive)
   (if scrollback
       (eshell/clear-scrollback)
-    (let ((eshell-input-filter-functions
-           (remq 'eshell-add-to-history eshell-input-filter-functions)))
+    (let ((eshell-input-filter-functions nil))
       (insert (make-string (window-size) ?\n))
       (eshell-send-input))))

-- 
Jonathan Kyle Mitchell





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31326; Package emacs. (Fri, 04 May 2018 10:43:02 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
Cc: 31326 <at> debbugs.gnu.org
Subject: Re: bug#31326: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Fri, 04 May 2018 06:42:12 -0400
tags 31326 + patch
quit

Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org> writes:

> I did a little more investigation into this issue. While I don't fully
> understand all the code paths of how it works, I found that let
> binding eshell-input-filter-functions to nil stops the infinite
> looping.

> Here's a diff for the change that works for me:

> -    (let ((eshell-input-filter-functions
> -           (remq 'eshell-add-to-history eshell-input-filter-functions)))
> +    (let ((eshell-input-filter-functions nil))
>        (insert (make-string (window-size) ?\n))
>        (eshell-send-input))))

Makes sense, I'll push this to master in a few days.  Have you assigned
copyright for Emacs?  If no, I'll mark it as a tiny change.






Added tag(s) patch. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 04 May 2018 10:43:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31326; Package emacs. (Fri, 04 May 2018 18:08:01 GMT) Full text and rfc822 format available.

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

From: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 31326 <at> debbugs.gnu.org
Subject: Re: bug#31326: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Fri, 4 May 2018 13:07:01 -0500
On 05/04/2018 05:42 AM, Noam Postavsky wrote:
> tags 31326 + patch
> quit
>
> Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org> writes:
>
>> I did a little more investigation into this issue. While I don't fully
>> understand all the code paths of how it works, I found that let
>> binding eshell-input-filter-functions to nil stops the infinite
>> looping.
>> Here's a diff for the change that works for me:
>> -    (let ((eshell-input-filter-functions
>> -           (remq 'eshell-add-to-history eshell-input-filter-functions)))
>> +    (let ((eshell-input-filter-functions nil))
>>         (insert (make-string (window-size) ?\n))
>>         (eshell-send-input))))
> Makes sense, I'll push this to master in a few days.  Have you assigned
> copyright for Emacs?  If no, I'll mark it as a tiny change.
>
>

Thanks. No, I don't have any copyright papers signed. What's the process 
for doing that?

-- 
Jonathan Kyle Mitchell





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31326; Package emacs. (Fri, 04 May 2018 20:17:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
Cc: 31326 <at> debbugs.gnu.org, npostavs <at> gmail.com
Subject: Re: bug#31326: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Fri, 04 May 2018 23:16:40 +0300
> From: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
> Date: Fri, 4 May 2018 13:07:01 -0500
> Cc: 31326 <at> debbugs.gnu.org
> 
> No, I don't have any copyright papers signed. What's the process 
> for doing that?

I can send you the instructions, if it's okay with you.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31326; Package emacs. (Sat, 05 May 2018 00:55:02 GMT) Full text and rfc822 format available.

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

From: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 31326 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#31326: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Sat, 05 May 2018 00:53:41 +0000
[Message part 1 (text/plain, inline)]
Yes, please do.

On Fri, May 4, 2018, 3:17 PM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
> > Date: Fri, 4 May 2018 13:07:01 -0500
> > Cc: 31326 <at> debbugs.gnu.org
> >
> > No, I don't have any copyright papers signed. What's the process
> > for doing that?
>
> I can send you the instructions, if it's okay with you.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31326; Package emacs. (Sat, 05 May 2018 06:42:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
Cc: 31326 <at> debbugs.gnu.org, npostavs <at> gmail.com
Subject: Re: bug#31326: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Sat, 05 May 2018 09:40:55 +0300
> From: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
> Date: Sat, 05 May 2018 00:53:41 +0000
> Cc: Noam Postavsky <npostavs <at> gmail.com>, 31326 <at> debbugs.gnu.org
> 
> Yes, please do. 

Thanks, sent off-list.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31326; Package emacs. (Wed, 11 Jul 2018 01:31:01 GMT) Full text and rfc822 format available.

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

From: Noam Postavsky <npostavs <at> gmail.com>
To: Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org>
Cc: 31326 <at> debbugs.gnu.org
Subject: Re: bug#31326: 27.0.50; eshell/clear exceeds max-lisp-eval-depth
Date: Tue, 10 Jul 2018 21:30:47 -0400
tags 31326 fixed
close 31326 27.1
quit

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

> Makes sense, I'll push this to master in a few days.

A little late, but now pushed.

[1: 39489f782e]: 2018-07-10 21:22:52 -0400
  Fix infinite recursion in eshell/clear (Bug#31326)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=39489f782e436a490d1bec32d7ed9b7bcdacda24




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

bug marked as fixed in version 27.1, send any further explanations to 31326 <at> debbugs.gnu.org and Jonathan Kyle Mitchell <kyle <at> jonathanmitchell.org> Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 11 Jul 2018 01:31:03 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. (Wed, 08 Aug 2018 11:24:05 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 27 Aug 2019 16:40:01 GMT) Full text and rfc822 format available.

Forcibly Merged 31326 37198. Request was from Noam Postavsky <npostavs <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 27 Aug 2019 16:40:01 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. (Wed, 25 Sep 2019 11:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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