GNU bug report logs - #65291
30.0.50; `inhibit-interaction` is too eager

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Stefan Monnier <monnier@HIDDEN>; merged with #67837; dated Mon, 14 Aug 2023 15:24:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Merged 65291 67837. Request was from Stefan Monnier <monnier@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 65291 67837. Request was from Stefan Monnier <monnier@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Aug 2023 15:23:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 14 11:23:45 2023
Received: from localhost ([127.0.0.1]:34204 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qVZQ1-0002Zy-Bn
	for submit <at> 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 <monnier@HIDDEN>) id 1qVZPz-0002Zm-HX
 for submit <at> 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 <monnier@HIDDEN>)
 id 1qVZPt-0000X7-GG
 for bug-gnu-emacs@HIDDEN; 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 <monnier@HIDDEN>)
 id 1qVZPq-0002GT-NN
 for bug-gnu-emacs@HIDDEN; 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 <bug-gnu-emacs@HIDDEN>; 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 <bug-gnu-emacs@HIDDEN>; 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 <bug-gnu-emacs@HIDDEN>; Mon, 14 Aug 2023 11:23:27 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.0.50; `inhibit-interaction` is too eager
Date: Mon, 14 Aug 2023 11:23:18 -0400
Message-ID: <jwvpm3psl5l.fsf@HIDDEN>
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@HIDDEN; 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 <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
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;





Acknowledgement sent to Stefan Monnier <monnier@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#65291; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 20 Jan 2024 12:30:02 UTC

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