From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57804: An infinite loop in a `fontify-region' function causes Emacs to hang indefinitely Date: Wed, 14 Sep 2022 21:18:33 +0300 Message-ID: <83leql251i.fsf@gnu.org> References: <87a672j5li.fsf@dick> <87k0654zde.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9917"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57804@debbugs.gnu.org, dick.r.chiang@gmail.com, pogonyshev@gmail.com To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 14 20:20:18 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYWzh-0002Lf-QD for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Sep 2022 20:20:18 +0200 Original-Received: from localhost ([::1]:51952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYWzg-0000Ak-JI for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 14 Sep 2022 14:20:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYWyk-0008TW-Uf for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 14:19:21 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39237) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oYWyV-0002Vz-QE for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 14:19:18 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oYWyV-0006Eg-LR for bug-gnu-emacs@gnu.org; Wed, 14 Sep 2022 14:19:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Sep 2022 18:19:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57804 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 57804-submit@debbugs.gnu.org id=B57804.166317953323919 (code B ref 57804); Wed, 14 Sep 2022 18:19:03 +0000 Original-Received: (at 57804) by debbugs.gnu.org; 14 Sep 2022 18:18:53 +0000 Original-Received: from localhost ([127.0.0.1]:56163 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYWyL-0006Di-3a for submit@debbugs.gnu.org; Wed, 14 Sep 2022 14:18:53 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYWyG-0006DF-MJ for 57804@debbugs.gnu.org; Wed, 14 Sep 2022 14:18:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:39794) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYWyB-0002MV-Dm; Wed, 14 Sep 2022 14:18:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=nHLVxUKQgq3TnEHl8c+QvHghs/16K6yx5lB2JsywJuo=; b=f1NpqclGd7b1 swRj6hmTVCzvzRaYP2rau8WqFpEz+02DzfS3geuB4SnyJgY3veoxlFMwkdNs5EA3Eoj5ll6cnvaTM r0ULpUoKxpatigzfJWMVXpf85DWRPFB4AipNA5u+zw1rpvDOig2+miy4ysFlog3zBDEKORZi0u2Zh 7f6w8IM3hnrmYRTUV7d1kfqm8rEpNeYxJUoPmlrrz2FG965nZxL0/vSSfG5aAH9dHdUT57dDX8C85 g4vd6XWFPOOOEeHCnZgaq4M7g+rMTHQqz980vi7pjN1dtx8ZItYdoqwbP0XJIqTc5v/lzwcDTW4NP j4RQFzPJARnvf79Ky35Jiw==; Original-Received: from [87.69.77.57] (port=3258 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYWyA-00015Y-Qh; Wed, 14 Sep 2022 14:18:43 -0400 In-Reply-To: <87k0654zde.fsf@gnus.org> (message from Lars Ingebrigtsen on Wed, 14 Sep 2022 19:52:45 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:242511 Archived-At: > Cc: 57804@debbugs.gnu.org, Paul Pogonyshev > From: Lars Ingebrigtsen > 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.