From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#63253: 29.0.90; with-delayed-message fails in combination with inhibit-message Date: Mon, 08 May 2023 11:13:37 -0400 Message-ID: References: <87r0rxdwc8.fsf@daniel-mendler.de> <837ctidgab.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37534"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: mail@daniel-mendler.de, 63253@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 08 17:14:41 2023 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 1pw2ZU-0009XZ-Ek for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 May 2023 17:14:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pw2Yx-00050q-1N; Mon, 08 May 2023 11:14:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pw2Yv-0004yL-5Z for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 11:14:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pw2Ys-00016j-A7 for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 11:14:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pw2Ys-0002pY-50 for bug-gnu-emacs@gnu.org; Mon, 08 May 2023 11:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 May 2023 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63253 X-GNU-PR-Package: emacs Original-Received: via spool by 63253-submit@debbugs.gnu.org id=B63253.168355882810850 (code B ref 63253); Mon, 08 May 2023 15:14:02 +0000 Original-Received: (at 63253) by debbugs.gnu.org; 8 May 2023 15:13:48 +0000 Original-Received: from localhost ([127.0.0.1]:41340 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw2Ye-0002ov-90 for submit@debbugs.gnu.org; Mon, 08 May 2023 11:13:48 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28433) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pw2Yc-0002oh-RC for 63253@debbugs.gnu.org; Mon, 08 May 2023 11:13:47 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2F9991001A4; Mon, 8 May 2023 11:13:41 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D747E100193; Mon, 8 May 2023 11:13:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1683558819; bh=xLu/7ovlpT4vLBO1Z7ZpgHParpMzi4h57rsr1BJqqBg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=oC60/dXzFZutngKYnl2rdyh0xm9cwkluNQ2lRZt77RlNq59vUZ1D1B5LD8QXqj1m8 RISUp/3IgzxAOOsPjgDJtkSriX+A79TWznN7Vsi+bnhAKSIbpfkbmmE20BMl3iRRc7 +sEQ3ikidN6TrGNiVZMHp9rQAtfXjmpumBKINWsJzsPPeUMemWDl98H8muzmLwhhNQ mYH8jF28L6GCZvRYJiAopYsYA6/7K/xEXAMbxmrydJuVBVwpt9VqCniswETDvWNOLx N4yYZk7fLu4IANxtqNQtvNF96aJV01Bbtu6k+M/Q2PUMlxaUc1eDeVzfrc/QXFzQfi y5sxUJp7X1Iwg== Original-Received: from pastel (unknown [45.72.217.176]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A96901206CB; Mon, 8 May 2023 11:13:39 -0400 (EDT) In-Reply-To: <837ctidgab.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 08 May 2023 17:55:08 +0300") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261335 Archived-At: >> So `set-message-function` is "dangerous" because it runs ELisp code from >> `message3` => `message3_nolog` => `set_message`. > > So I guess we need to have run_timers bind some variable, and then in > set_message, if that variable is non-nil, we should avoid calling > functions from set-message-function? That's probably the best short-term workaround, yes. The quick hack below seems to avoid the problem for me (at the cost of ignoring `inhibit-message` for the `with-delayed-message`s). Stefan diff --git a/src/alloc.c b/src/alloc.c index 05a19f0b7e9..7ff2cd3b100 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -367,7 +367,7 @@ #define PUREBEG (char *) pure /* If positive, garbage collection is inhibited. Otherwise, zero. */ -static intptr_t garbage_collection_inhibited; +intptr_t garbage_collection_inhibited; /* The GC threshold in bytes, the last time it was calculated from gc-cons-threshold and gc-cons-percentage. */ diff --git a/src/xdisp.c b/src/xdisp.c index 43847544396..a5d7d256b6d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12810,6 +12810,8 @@ truncate_message_1 (void *a1, Lisp_Object a2) return false; } +extern intptr_t garbage_collection_inhibited; + /* Set the current message to STRING. */ static void @@ -12819,7 +12821,11 @@ set_message (Lisp_Object string) eassert (STRINGP (string)); - if (FUNCTIONP (Vset_message_function)) + if (FUNCTIONP (Vset_message_function) + /* FIXME: (bug#63253) We should really make the regexp engine re-entrant, + but in the mean time, let's ignore `set-message-function` when + called from `probably_quit`. */ + && !garbage_collection_inhibited) { specpdl_ref count = SPECPDL_INDEX (); specbind (Qinhibit_quit, Qt);