GNU bug report logs - #57804
An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely

Previous Next

Package: emacs;

Reported by: Paul Pogonyshev <pogonyshev <at> gmail.com>

Date: Wed, 14 Sep 2022 15:07:01 UTC

Severity: normal

Tags: wontfix

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 57804 <at> debbugs.gnu.org, dick.r.chiang <at> gmail.com, pogonyshev <at> gmail.com
Subject: Re: bug#57804: An infinite loop in a `fontify-region' function causes
 Emacs to hang indefinitely
Date: Wed, 14 Sep 2022 21:18:33 +0300
> Cc: 57804 <at> debbugs.gnu.org, Paul Pogonyshev <pogonyshev <at> gmail.com>
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Wed, 14 Sep 2022 19:52:45 +0200
> 
> So I think there's scope for us to do something practical here with this
> annoying problem.  It's hard enough to develop font locking code without
> Emacs suddenly (and unbreakably) hanging on you when you've typed in
> some buggy code.

Just run your development version under a debugger, and you will
always be able to interrupt any loop, anywhere.

And I think you greatly underestimate the conceptual difficulty here.
Your conclusions are specific to this toy program.  But in real-life
use cases, it is entirely unclear how to handle this:

  . the fact that redisplay is called several times in a row doesn't
    necessarily mean we have a bug, there are packages out there which
    cause that due to stuff they do in various hooks (like linum.el,
    which moves overlays etc.)
  . the buggy code could be in some function registered with jit-lock
    or run from some hook invoked by redisplay that have nothing to do
    with font-lock, in which case turning off font-lock will not solve
    anything

IOW, the general solution to this is not apparent, and I'm not sure it
exists, the only solution I'm aware of is to run unstable code under a
debugger.




This bug report was last modified 2 years and 230 days ago.

Previous Next


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