From unknown Sun Jun 15 08:39:33 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#65291 <65291@debbugs.gnu.org> To: bug#65291 <65291@debbugs.gnu.org> Subject: Status: 30.0.50; `inhibit-interaction` is too eager Reply-To: bug#65291 <65291@debbugs.gnu.org> Date: Sun, 15 Jun 2025 15:39:33 +0000 retitle 65291 30.0.50; `inhibit-interaction` is too eager reassign 65291 emacs submitter 65291 Stefan Monnier severity 65291 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 14 11:23:45 2023 Received: (at submit) by debbugs.gnu.org; 14 Aug 2023 15:23:45 +0000 Received: from localhost ([127.0.0.1]:34204 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVZQ1-0002Zy-Bn for submit@debbugs.gnu.org; Mon, 14 Aug 2023 11:23:45 -0400 Received: from lists.gnu.org ([2001:470:142::17]:34660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qVZPz-0002Zm-HX for submit@debbugs.gnu.org; Mon, 14 Aug 2023 11:23:44 -0400 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 1qVZPt-0000X7-GG for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2023 11:23:37 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qVZPq-0002GT-NN for bug-gnu-emacs@gnu.org; Mon, 14 Aug 2023 11:23:36 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 463BA1000EF for ; Mon, 14 Aug 2023 11:23:33 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1692026607; bh=HhnpaAerK+/v59G28NcinrvaGprvpUK/NooiHy8WwB8=; h=From:To:Subject:Date:From; b=ZZQ69duqGGxgHzp7yuOd8Ooj/fObysMuHLcKKUpGoOW7VWnw+D8C9PAKxPQ+R7+oP lhT301+rjj2v0hMarIL86wDB/57F96VhmZn8Y3MfA5pED5HWMtksOiwBMxBrPoPnOQ OhV4lg8DcoI+8Ibz+3WdZB6gR+an0Cw82XinUz2wEHrS8H5Ds6Xhcss/4YR46qaRVj A7ZVz1iY/3V8lxqvoNeYMb6JEOoeCGQc0qEZyi9UKBu8FRA2wK3Q6YG31JvmZ0N1Pt n7NAT0q2MlHNyUbxUl6Ko/z2iMeUbhe/1yQdhs6IYdyWZL6JmvrWK2i2WsKT/7ZXf2 u2gjYBAxiCu5g== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C0ABC10006B for ; Mon, 14 Aug 2023 11:23:27 -0400 (EDT) Received: from pastel (unknown [45.72.228.154]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A9EA612030F for ; Mon, 14 Aug 2023 11:23:27 -0400 (EDT) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: 30.0.50; `inhibit-interaction` is too eager Date: Mon, 14 Aug 2023 11:23:18 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.169 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Package: Emacs Version: 30.0.50 When `inhibit-interaction` is non-nil, all calls to `read-from-minibuffer` or `read-event` will signal an error, even when those calls are carefully wrapped in such a way that they will return without needing any user interaction, thanks to timeouts, `unread-command-events`, or whatnot. The patch below reduces the number of false positives by delaying the check to the point where we know "for sure" that we will have to wait, but is still not quite right because it doesn't handle the timeout case :-( Stefan diff --git a/src/keyboard.c b/src/keyboard.c index 78c88a2859b..ef243bc9b5d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -2738,6 +2738,11 @@ read_char (int commandflag, Lisp_Object map, goto exit; } + /* Looks like we really have to wait for interactive user input. + FIXME: This still suffers from false positives when `read-event` is + called with a time out to wait for things like process output :-( */ + barf_if_interaction_inhibited (); + /* Make a longjmp point for quits to use, but don't alter getcjmp just yet. We will do that below, temporarily for short sections of code, when appropriate. local_getcjmp must be in effect diff --git a/src/lread.c b/src/lread.c index 251da5670d0..893ff70fc62 100644 --- a/src/lread.c +++ b/src/lread.c @@ -951,8 +951,6 @@ DEFUN ("read-char", Fread_char, Sread_char, 0, 3, 0, { Lisp_Object val; - barf_if_interaction_inhibited (); - if (! NILP (prompt)) { cancel_echoing (); @@ -989,8 +987,6 @@ DEFUN ("read-event", Fread_event, Sread_event, 0, 3, 0, `inhibited-interaction' error. */) (Lisp_Object prompt, Lisp_Object inherit_input_method, Lisp_Object seconds) { - barf_if_interaction_inhibited (); - if (! NILP (prompt)) { cancel_echoing (); @@ -1028,8 +1024,6 @@ DEFUN ("read-char-exclusive", Fread_char_exclusive, Sread_char_exclusive, 0, 3, { Lisp_Object val; - barf_if_interaction_inhibited (); - if (! NILP (prompt)) { cancel_echoing (); diff --git a/src/minibuf.c b/src/minibuf.c index 58adde1bf66..4636ce8f308 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -316,6 +316,8 @@ read_minibuf_noninteractive (Lisp_Object prompt, bool expflag, struct emacs_tty etty; bool etty_valid UNINIT; + barf_if_interaction_inhibited (); + /* Check, whether we need to suppress echoing. */ if (CHARACTERP (Vread_hide_char)) hide_char = XFIXNAT (Vread_hide_char); @@ -1344,8 +1346,6 @@ DEFUN ("read-from-minibuffer", Fread_from_minibuffer, { Lisp_Object histvar, histpos, val; - barf_if_interaction_inhibited (); - CHECK_STRING (prompt); if (NILP (keymap)) keymap = Vminibuffer_local_map; From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 16 10:52:56 2023 Received: (at control) by debbugs.gnu.org; 16 Dec 2023 15:52:56 +0000 Received: from localhost ([127.0.0.1]:55804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEWyG-0001O4-EG for submit@debbugs.gnu.org; Sat, 16 Dec 2023 10:52:56 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:56927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rEWyD-0001Nl-KI; Sat, 16 Dec 2023 10:52:54 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8EB45100068; Sat, 16 Dec 2023 10:52:47 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1702741966; bh=y3TunpwzOogYXMRijDfv+4WgoZgt6MZMom8n6ftW0I0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=GgxewbU3gaZaRpW1NxSgrqXlXLQxRCxJ3pE5EApiuN1FqBlsSDcys6LYbpw/H8O8t PN3E9ta5xbk3RY8wDJRwVJFYGUC8aZC9jOZykR/8ze2V3hUVAp/R8daFURDmBulS/v Z1Qb3xDlSV4LmhN8Myj7yiTCUjLknDTou7UhkKB3Giw0RvSeSc+bjuw0CISfAIExWG f0DT46qGbDmUuKoMiuy3l7eRgxjYLvaK6N1I5AO3NIw7rmyrE79ID16PkapnG500vN ZoUBfAGD+XdCYcazwFX0BgBozSezsG+L9Rkc2s7xiB0P1WEXMEfP+OYfU91tPS4dJh 652+cFBGl85yw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A11CA100033; Sat, 16 Dec 2023 10:52:46 -0500 (EST) Received: from pastel (65-110-221-238.cpe.pppoe.ca [65.110.221.238]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 69E4A12023C; Sat, 16 Dec 2023 10:52:46 -0500 (EST) From: Stefan Monnier To: Eli Zaretskii Subject: Re: bug#67837: 29.1.90; inhibit-interaction breaks keyboard macros In-Reply-To: <83h6kjnrzg.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 15 Dec 2023 22:14:11 +0200") Message-ID: References: <83le9vnvnn.fsf@gnu.org> <83jzpfnsle.fsf@gnu.org> <83h6kjnrzg.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Date: Sat, 16 Dec 2023 10:52:45 -0500 MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.031 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control Cc: sbaugh@janestreet.com, larsi@gnus.org, control@debbugs.gnu.org, 67837@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) merge 67837 65291 thanks AFAICT this is the same bug as bug#65291 and the suggested patch is similar. > I'm actually tend to think that this proposal is fundamentally wrong, > not just problematic implementation-wise. Providing input from a > keyboard macro is still input, and inhibit-interaction=t means asking > for input signals an error. So your suggestion subverts this feature, > and therefore it is simply wrong to install something like that. I guess it begs the question: what is the purpose of `inhibit-interaction`? The way I see it, the purpose is to avoid Emacs waiting for user input when we know there's no user, and thus signal an error if we ever get to this point. Basically, I think since our test suite runs just fine in batch, we should be able to run it with inhibit-interaction=t as well (which would fix annoying problems when some test fails and ends up waiting for user input). Note that trying to make the whole test suite runs with `inhibit-interaction` non-nil is not at all straightforward, sadly: there are several places where we do call things like `read-event` without providing any keyboard input (i.e. without `unread-command-event` or keyboard macros) and instead use a timeout because this `read-event` is just there to force Emacs to wait while some external process sends us some reply. Should these be considered "interaction"? If not, then we open up a whole where some code may call `read-event` with a relatively short timeout within a tight loop where the purpose *is* to get user input and where the timeout is only present to keep something else updated while we wait for that user's input. Stefan