Commit fdb4f6635351b3f3b15b5e948c39e9efcdd615df causing Emacs to crash for me
I don't understand why, but this commit: http://gitorious.org/evil/evil/commit/fdb4f6635351b3f3b15b5e948c39e9efcdd615... … has caused emacs to start crashing for me. A video to prove I'm not crazy: http://screencast.com/t/58vWTsW0TTh I'm using Vanilla Emacs for OS X, 23.3, downloaded here: http://emacsformacosx.com/ Crash dump: http://pastie.org/2419689 I'm betting it's an Emacs bug that is being surfaced by that change, because it should not be possible to crash emacs by writing emacs lisp like that. Tim
On Aug 23, 2011, at 7:05 PM, Timothy Harper wrote:
I don't understand why, but this commit:
http://gitorious.org/evil/evil/commit/fdb4f6635351b3f3b15b5e948c39e9efcdd615...
… has caused emacs to start crashing for me.
A video to prove I'm not crazy:
http://screencast.com/t/58vWTsW0TTh
I'm using Vanilla Emacs for OS X, 23.3, downloaded here: http://emacsformacosx.com/
Crash dump: http://pastie.org/2419689
I'm betting it's an Emacs bug that is being surfaced by that change, because it should not be possible to crash emacs by writing emacs lisp like that.
Tim
After some experimenting, I was able to narrow down the cause of the crash to lines 17-19: http://gitorious.org/evil/evil/blobs/fdb4f6635351b3f3b15b5e948c39e9efcdd615d... It is specifically triggered by executing the following (generated by lines 18-19) (eval-after-load 'comint `(evil-make-overriding-map comint-mode-map)) If I replace 17-19 with that bit of code, it crashes. If I do it with any other mode in evil-intercept-maps, it doesn't crash. If I evaluate the above after emacs has started successfully, it doesn't invoke a crash. In order to crash the code must be evaluated during emacs initialization. A work-around then, I propose, to those experiencing a similar problem, is to change the value evil-overriding-maps to omit the comint override. As a more long term fix… well, I don't know where to start. It's vague to me why this would be causing a crash, and I'm not sure if it's easy to reproduce (if it's an interaction with something else I am using in Emacs or not…). Tim
On 2011-08-24 03:48 +0200, Timothy Harper wrote:
On Aug 23, 2011, at 7:05 PM, Timothy Harper wrote:
I'm betting it's an Emacs bug that is being surfaced by that change, because it should not be possible to crash emacs by writing emacs lisp like that.
It is specifically triggered by executing the following (generated by lines 18-19)
(eval-after-load 'comint `(evil-make-overriding-map comint-mode-map))
Thank you for narrowing it down. I'll have a go at simplifying `evil-make-overriding-map'. Does commit d039268 change anything? -- Vegard
On Aug 24, 2011, at 6:19 AM, Vegard Øye wrote:
On 2011-08-24 03:48 +0200, Timothy Harper wrote:
On Aug 23, 2011, at 7:05 PM, Timothy Harper wrote:
I'm betting it's an Emacs bug that is being surfaced by that change, because it should not be possible to crash emacs by writing emacs lisp like that.
It is specifically triggered by executing the following (generated by lines 18-19)
(eval-after-load 'comint `(evil-make-overriding-map comint-mode-map))
Thank you for narrowing it down.
I'll have a go at simplifying `evil-make-overriding-map'. Does commit d039268 change anything?
That does it, Vegard! Nice work shooting in the dark. How do you think would we could best describe this bug to the emacs-devel mailing list? Creating self-referential keycaps causes emacs to crash in certain cases? Tim
On 2011-08-24 19:55 +0200, Timothy Harper wrote:
How do you think would we could best describe this bug to the emacs-devel mailing list? Creating self-referential keycaps causes emacs to crash in certain cases?
Well, not that there's much reason to create self-referential keymaps in any case. (Ahem.) But there are some issues that should be fixed, one of them being a conflict between the backquote and the read syntax for self-referential structures. For an example straight out of the Emacs Lisp Reference Manual, you can write a list that has itself as the second element like this: (setq x '#1=(a #1#)) Substitute the quote with a backquote, though, and Emacs signals the error "Variable binding depth exceeds max-specpdl-size": (setq x `#1=(a #1#)) Then there's the case of self-referential lambda functions. If you write the function below, how will it byte-compile? '#1=(lambda () #1#) As it turns out, it won't: instead of a byte-compiled function that somehow returns itself, we get the max-specpdl-size error again. I think the difficulty with implementing self-referential structures is that they are contrary to a lot of naïve assumptions one would otherwise make about the code. Therefore, no implementation is likely to get it right "by accident"; the implementer has to be consciously aware of the numerous situations that may arise. -- Vegard
On Thu, 25 Aug 2011 19:12:20 +0200 Vegard Øye wrote: [...]
But there are some issues that should be fixed, one of them being a conflict between the backquote and the read syntax for self-referential structures. For an example straight out of the Emacs Lisp Reference Manual, you can write a list that has itself as the second element like this:
(setq x '#1=(a #1#))
Substitute the quote with a backquote, though, and Emacs signals the error "Variable binding depth exceeds max-specpdl-size":
(setq x `#1=(a #1#))
Then there's the case of self-referential lambda functions. If you write the function below, how will it byte-compile?
'#1=(lambda () #1#)
I don't think there is anything surprising about either of your examples: both ``' and `lambda' are macros, so if you create a cycle, it expands and expands and expands and expands and expands... you get the idea. OTOH, if I understand correctly, Tim said that his Emacs crashed. No matter what you do in Elisp, Emacs should never crash, so that would definitely be a candidate for `report-emacs-bug'. -- Štěpán
On 2011-08-25 20:25 +0200, Štěpán Němec wrote:
On Thu, 25 Aug 2011 19:12:20 +0200 Vegard Øye wrote:
Emacs signals the error "Variable binding depth exceeds max-specpdl-size":
(setq x `#1=(a #1#))
Then there's the case of self-referential lambda functions. If you write the function below, how will it byte-compile?
'#1=(lambda () #1#)
I don't think there is anything surprising about either of your examples: both ``' and `lambda' are macros, so if you create a cycle, it expands and expands and expands and expands and expands... you get the idea.
Ah, so /that's/ what's going on. Well, for what it's worth, the lambda issue can be resolved then. This enters an infinite regress: (macroexpand-all '#1=(lambda () #1#)) But the following does not, since quoting the inner reference prevents further expansion: (macroexpand-all '#1=(lambda () '#1#)) One can also avoid the backquote issue by constructing the list in parts and using `nconc' to piece them together.
OTOH, if I understand correctly, Tim said that his Emacs crashed. No matter what you do in Elisp, Emacs should never crash, so that would definitely be a candidate for `report-emacs-bug'.
Indeed. This should be sufficient to reproduce it: (eval-after-load 'comint '(define-key comint-mode-map "a" comint-mode-map)) In any case, I'll consider self-referential structures a big no-no from now on. -- Vegard
On Aug 25, 2011, at 3:15 PM, Vegard Øye wrote:
(eval-after-load 'comint '(define-key comint-mode-map "a" comint-mode-map))
This does cause the crash, but isolating it is proving to be very difficult :( Must be some interaction with another extension. If I start with a clean-slate emacs.d, then it doesn't cause a crash. However, if I place at top of my .emacs.d, it crashes. Tim
participants (3)
-
Timothy Harper -
Vegard Øye -
Štěpán Němec