unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely
@ 2022-09-14 15:05 Paul Pogonyshev
  2022-09-14 16:00 ` dick
                   ` (3 more replies)
  0 siblings, 4 replies; 59+ messages in thread
From: Paul Pogonyshev @ 2022-09-14 15:05 UTC (permalink / raw)
  To: 57804


[-- Attachment #1.1: Type: text/plain, Size: 976 bytes --]

To reproduce, save the attachment as `font-lock-hangs.el' and execute:

    $ emacs -Q -l font-lock-hangs.el

C-g doesn't help anymore. The only thing you can do is to kill and start
Emacs anew.

Git commit fd1ee05977.

To quote a discussion from another bug, the reply is from Eli Zaretski:

> > By the way, it would really be nice if Emacs could do something about
hangs irrespective of what causes
> > that. Even if Elisp code is buggy, Emacs itself should never allow it
to fall into an infinite loop and stop
> > responding to C-g, leaving full restart as the only way out.
>
> I think that's impossible in general, unless we restrict what Lisp
> programs can do.  Every programming language can be used to write a
> buggy program.
>
> However, it should be possible to prevent some cases of such
> problematic behavior, certainly so when the infloop is caused by our
> bug.  But for that we need to know the details of the specific case in
> order to investigate.

Paul

[-- Attachment #1.2: Type: text/html, Size: 1243 bytes --]

[-- Attachment #2: font-lock-hangs.el --]
[-- Type: text/x-emacs-lisp, Size: 843 bytes --]

(define-derived-mode buggy-mode nil "buggy"
  (setf font-lock-defaults '(nil nil t nil (font-lock-fontify-region-function . buggy-fontifier)))
  (font-lock-mode 1))

(defun buggy-fontifier (start end loudly)
  (add-face-text-property start (min (+ start 15) end) 'bold)
  (while t
    "whoopsie")
  nil)

(switch-to-buffer "*scratch*")
(dotimes (k 50)
  (insert "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n\n"))
(goto-char 1)
(buggy-mode)

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

end of thread, other threads:[~2022-11-28 18:32 UTC | newest]

Thread overview: 59+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 15:05 bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely Paul Pogonyshev
2022-09-14 16:00 ` dick
2022-09-14 16:06   ` Paul Pogonyshev
2022-09-14 16:14 ` dick
2022-09-14 17:52   ` Lars Ingebrigtsen
2022-09-14 18:18     ` Eli Zaretskii
2022-09-14 16:41 ` Lars Ingebrigtsen
2022-09-14 16:57   ` Paul Pogonyshev
2022-09-14 17:25     ` Lars Ingebrigtsen
2022-09-14 17:30       ` Paul Pogonyshev
2022-09-14 17:43       ` Eli Zaretskii
2022-09-14 17:45         ` Lars Ingebrigtsen
2022-09-14 17:49           ` Eli Zaretskii
2022-09-15  2:17             ` Ihor Radchenko
2022-09-14 17:34     ` Gregory Heytings
2022-09-15 14:47       ` Paul Pogonyshev
2022-09-15 15:10         ` Gregory Heytings
2022-09-15 15:37           ` Paul Pogonyshev
2022-09-15 16:08             ` Gregory Heytings
2022-09-15 16:19               ` Paul Pogonyshev
2022-09-15 16:44                 ` Gregory Heytings
2022-09-15 18:49                   ` Paul Pogonyshev
2022-09-15 19:16                     ` Eli Zaretskii
2022-09-15 19:36                       ` Paul Pogonyshev
2022-09-15 19:45                         ` Eli Zaretskii
2022-09-15 20:18                         ` Gregory Heytings
2022-09-15 20:22                           ` Lars Ingebrigtsen
2022-09-15 20:40                           ` Paul Pogonyshev
2022-09-15 20:44                             ` Gregory Heytings
2022-09-15 21:17                               ` Paul Pogonyshev
2022-09-15 21:32                                 ` Gregory Heytings
2022-09-15 21:49                                   ` Paul Pogonyshev
2022-09-15 22:16                                     ` Gregory Heytings
2022-09-15 22:53                                       ` Paul Pogonyshev
2022-09-15 23:13                                         ` Gregory Heytings
2022-09-16  6:40                                         ` Eli Zaretskii
2022-09-16 10:08                                           ` Paul Pogonyshev
2022-09-16 10:44                                             ` Eli Zaretskii
2022-09-16  6:31                             ` Eli Zaretskii
     [not found]                               ` <1260fd38-d4b3-5ca1-5b15-78f59c0255b6@yandex.ru>
     [not found]                                 ` <83o7t9k8fr.fsf@gnu.org>
     [not found]                                   ` <CAG7Bpaow570a8Qrq6VxU+=MNF55UmnCMFFXT2Eg=vQUTgrxeoQ@mail.gmail.com>
     [not found]                                     ` <34e17bf2a6bdd269fba7@heytings.org>
     [not found]                                       ` <CAG7BpapFE0HEwi8iUoStz9EyAwH-QdZ_CxOUNtdUeKDmzCrZaQ@mail.gmail.com>
     [not found]                                         ` <338f50d421074805735f@heytings.org>
     [not found]                                           ` <831qpnngeg.fsf@gnu.org>
     [not found]                                             ` <338f50d421b672315145@heytings.org>
2022-11-28 18:32                                               ` Eli Zaretskii
2022-09-16  1:17                           ` Ihor Radchenko
2022-09-16  5:35                           ` Eli Zaretskii
2022-09-15 19:44                     ` Gregory Heytings
2022-09-15 20:07                       ` Paul Pogonyshev
2022-09-15 20:26                         ` Gregory Heytings
2022-09-16  5:37                           ` Eli Zaretskii
2022-09-15 22:20                       ` dick
2022-09-15 22:38                         ` Gregory Heytings
2022-09-16  6:19                         ` Eli Zaretskii
2022-09-16  7:44                         ` Gerd Möllmann
2022-09-14 17:02 ` Eli Zaretskii
2022-09-14 17:25   ` Paul Pogonyshev
2022-09-14 17:32     ` Eli Zaretskii
2022-09-14 17:38   ` Lars Ingebrigtsen
2022-09-14 17:44     ` Eli Zaretskii
2022-09-14 17:46       ` Lars Ingebrigtsen
2022-09-14 17:51         ` Eli Zaretskii
2022-09-15  5:20     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-15  6:27       ` Eli Zaretskii

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