GNU bug report logs - #32257
26.1; read-multiple-choice inf loops on mouse clicks

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: Noam Postavsky <npostavs@HIDDEN>; dated Tue, 24 Jul 2018 12:07:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at submit) by debbugs.gnu.org; 31 Jul 2018 12:00:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 31 08:00:01 2018
Received: from localhost ([127.0.0.1]:35824 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fkTJp-0003sy-4Y
	for submit <at> debbugs.gnu.org; Tue, 31 Jul 2018 08:00:01 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53228)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fkTJn-0003sl-J9
 for submit <at> debbugs.gnu.org; Tue, 31 Jul 2018 07:59:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fkTJh-00018d-IX
 for submit <at> debbugs.gnu.org; Tue, 31 Jul 2018 07:59:54 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:36014)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1fkTJh-00018R-FL
 for submit <at> debbugs.gnu.org; Tue, 31 Jul 2018 07:59:53 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44192)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fkTJg-0003FZ-5d
 for bug-gnu-emacs@HIDDEN; Tue, 31 Jul 2018 07:59:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fkTJd-00016w-4A
 for bug-gnu-emacs@HIDDEN; Tue, 31 Jul 2018 07:59:52 -0400
Received: from [195.159.176.226] (port=40085 helo=blaine.gmane.org)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1fkTJc-00016O-St
 for bug-gnu-emacs@HIDDEN; Tue, 31 Jul 2018 07:59:49 -0400
Received: from list by blaine.gmane.org with local (Exim 4.84_2)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fkTHT-0006FB-4R
 for bug-gnu-emacs@HIDDEN; Tue, 31 Jul 2018 13:57:35 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Andy Moreton <andrewjmoreton@HIDDEN>
Subject: Re: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
Date: Tue, 31 Jul 2018 12:59:37 +0100
Lines: 48
Message-ID: <vz1d0v3y5sm.fsf@HIDDEN>
References: <87muug4z52.fsf@HIDDEN> <87y3dy3i05.fsf@HIDDEN>
 <83muudrqol.fsf@HIDDEN> <vz136w43o8w.fsf@HIDDEN>
 <83effosvx2.fsf@HIDDEN> <87r2jo3l0w.fsf@HIDDEN>
 <837elgss8l.fsf@HIDDEN> <87sh40189j.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: usenet@HIDDEN
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)
Cancel-Lock: sha1:NAHMMNoTKbxWVCiknT0p64eN5gk=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.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: -6.0 (------)

On Mon 30 Jul 2018, Noam Postavsky wrote:

> Eli Zaretskii <eliz@HIDDEN> writes:
>
>>> >> > If we want this change on emacs-26, we should carefully audit all the
>>> >> > other users of rmc.el
>>> 
>>> What should we check for though?
>>
>> Anything that read-event handles differently from read-char.  Maybe a
>> good starting point is to compile a list of the differences in
>> behavior between the two.
>
> Looking at the implementation, they both delegate to
> read_filtered_event, but read-char passes 1 for the first three args,
> where read-event passes 0.
>
>    If NO_SWITCH_FRAME, switch-frame events are stashed
>    until we get a character we like, and then stuffed into
>    unread_switch_frame.
>
>    If ASCII_REQUIRED, check function key events to see
>    if the unmodified version of the symbol has a Qascii_character
>    property, and use that character, if present.
>
>    If ERROR_NONASCII, signal an error if the input we
>    get isn't an ASCII character with modifiers.  If it's false but
>    ASCII_REQUIRED is true, just re-read until we get an ASCII
>    character.

So perhaps this `read-char' to `read-event' change will result in different
frame switching behaviour. I'm not sure how to test that though.

> Another possibility is to use read-char-exclusive which only changes
> ERROR_NON_ASCII to 0.  The downside is that when there are mouse clicks
> it prints the events into the minibuffer, covering the prompt (but
> typing "?"  still works to restore the prompt).

AS you have done, I read the implementation and tried a patch using
`read-char-exclusive'. The result is unusable as the printed events
obscure the original question.

The proper long term fix for this is to make read-multiple-choice use a
dedicated buffer rather than the minibuffer, and give better visibility
when more than one question is asked in succession. Perhaps also some
way to stop the echo area from obscuring the minibuffer ?

    AndyM





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#32257; Package emacs. Full text available.

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


Received: (at 32257) by debbugs.gnu.org; 31 Jul 2018 01:52:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jul 30 21:52:49 2018
Received: from localhost ([127.0.0.1]:35595 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fkJqD-0008N2-NH
	for submit <at> debbugs.gnu.org; Mon, 30 Jul 2018 21:52:49 -0400
Received: from mail-it0-f50.google.com ([209.85.214.50]:39974)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1fkJqB-0008Mp-Mp
 for 32257 <at> debbugs.gnu.org; Mon, 30 Jul 2018 21:52:47 -0400
Received: by mail-it0-f50.google.com with SMTP id h23-v6so2097784ita.5
 for <32257 <at> debbugs.gnu.org>; Mon, 30 Jul 2018 18:52:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=5E3JSU2GGMqoB6KX5ukn24CtX3V33gQxR/cILfx6ONU=;
 b=kBKm7zClAIuCGehYK1zLpxOIRTTaHlUdilW/FOyMzEKEKJ6VYpS9VQKlauzaz7c4ri
 H68cnQdtHucQiivNBQbswWWWx3PC/tBKU0M/xVQV4m9cBd6Qv37dLfTPeHgZnOnxxle+
 LUdMvFUGFx2PY3kx7d35W+cQh1M8nogfSBRyKjRApe3JV8c+ck2fGJ3QPzpcqCdjh2X3
 Bt7s5DqBdQYK9hVJtxYwhrBJWt+DCABpWkGPRcyZMeWslzzCiYc/F2f9BfUjkTxiSnbr
 QhVANfJdNvFkd9kmQo90UPiuL5YASdQ+I/WeAJhWYxIa7xL81VVJKPoom49XXoVrMmfD
 zuGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=5E3JSU2GGMqoB6KX5ukn24CtX3V33gQxR/cILfx6ONU=;
 b=EIrclo/1hYqbReu129qh61TCLVlW3+C4Ku7H5VjWL/OTRJP54AxPnALm82FlZyxhfV
 P/kQccrkcWfTlQWIogW3gwLiihyVPOR5W9GP6hs9Ck78TyQq+KQiG+jDpr+A+mEQio82
 xVIlT+R1z9cMGUnkH8itjGrMGzRAbNEaYblevoJZQVWZvzqonH8JTYOEtgEVxVe6h3HD
 HuC8Tjnq3PAznrDlh+QArJ5F61vIxGzDZznNsrt42MRYvagTGVyEfLIc1xFLnzW800BC
 PnDQveEsbAHdhaVTq7GWBZCUBecqsp2VHbe+EpfMF2hM2kp3sRlcejDdsqDqFQCANZyM
 agig==
X-Gm-Message-State: AOUpUlFQqdZ8QQ+9S3/nD0V577eOIE834sgzACxaFPf2Bch/hSTGAIO9
 1wxqNVk3W9W5r6poBHoEjqI=
X-Google-Smtp-Source: AAOMgpdXLUguXcSHvEcTmQTSf6gJRA+QmSZOox3yZjpItc1gESti3kT3KUAJAXfMIKBSbldiqwwdgg==
X-Received: by 2002:a24:2ed4:: with SMTP id
 i203-v6mr1462952ita.114.1533001962141; 
 Mon, 30 Jul 2018 18:52:42 -0700 (PDT)
Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.googlemail.com with ESMTPSA id
 n142-v6sm7702909itb.3.2018.07.30.18.52.41
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Mon, 30 Jul 2018 18:52:41 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
References: <87muug4z52.fsf@HIDDEN> <87y3dy3i05.fsf@HIDDEN>
 <83muudrqol.fsf@HIDDEN> <vz136w43o8w.fsf@HIDDEN>
 <83effosvx2.fsf@HIDDEN> <87r2jo3l0w.fsf@HIDDEN>
 <837elgss8l.fsf@HIDDEN>
Date: Mon, 30 Jul 2018 21:52:40 -0400
In-Reply-To: <837elgss8l.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 27 Jul
 2018 16:50:02 +0300")
Message-ID: <87sh40189j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 32257
Cc: andrewjmoreton@HIDDEN, 32257 <at> debbugs.gnu.org
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 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> >> > If we want this change on emacs-26, we should carefully audit all the
>> >> > other users of rmc.el
>> 
>> What should we check for though?
>
> Anything that read-event handles differently from read-char.  Maybe a
> good starting point is to compile a list of the differences in
> behavior between the two.

Looking at the implementation, they both delegate to
read_filtered_event, but read-char passes 1 for the first three args,
where read-event passes 0.

   If NO_SWITCH_FRAME, switch-frame events are stashed
   until we get a character we like, and then stuffed into
   unread_switch_frame.

   If ASCII_REQUIRED, check function key events to see
   if the unmodified version of the symbol has a Qascii_character
   property, and use that character, if present.

   If ERROR_NONASCII, signal an error if the input we
   get isn't an ASCII character with modifiers.  If it's false but
   ASCII_REQUIRED is true, just re-read until we get an ASCII
   character.

Another possibility is to use read-char-exclusive which only changes
ERROR_NON_ASCII to 0.  The downside is that when there are mouse clicks
it prints the events into the minibuffer, covering the prompt (but
typing "?"  still works to restore the prompt).

--- i/lisp/emacs-lisp/rmc.el
+++ w/lisp/emacs-lisp/rmc.el
@@ -118,7 +118,7 @@ read-multiple-choice
                             choices)))
                   (condition-case nil
                       (let ((cursor-in-echo-area t))
-                        (read-char))
+                        (read-char-exclusive))
                     (error nil))))
           (setq answer (lookup-key query-replace-map (vector tchar) t))
           (setq tchar




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#32257; Package emacs. Full text available.

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


Received: (at 32257) by debbugs.gnu.org; 27 Jul 2018 13:50:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 27 09:50:14 2018
Received: from localhost ([127.0.0.1]:59737 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fj38I-00066h-K4
	for submit <at> debbugs.gnu.org; Fri, 27 Jul 2018 09:50:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33636)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1fj38G-00066S-VO
 for 32257 <at> debbugs.gnu.org; Fri, 27 Jul 2018 09:50:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1fj386-0001XQ-L4
 for 32257 <at> debbugs.gnu.org; Fri, 27 Jul 2018 09:50:07 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59881)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1fj386-0001X9-G8; Fri, 27 Jul 2018 09:50:02 -0400
Received: from [176.228.60.248] (port=3922 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1fj385-0004Zd-UJ; Fri, 27 Jul 2018 09:50:02 -0400
Date: Fri, 27 Jul 2018 16:50:02 +0300
Message-Id: <837elgss8l.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
In-reply-to: <87r2jo3l0w.fsf@HIDDEN> (message from Noam Postavsky on Fri,
 27 Jul 2018 08:45:03 -0400)
Subject: Re: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
References: <87muug4z52.fsf@HIDDEN> <87y3dy3i05.fsf@HIDDEN>
 <83muudrqol.fsf@HIDDEN> <vz136w43o8w.fsf@HIDDEN>
 <83effosvx2.fsf@HIDDEN> <87r2jo3l0w.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 32257
Cc: 32257 <at> debbugs.gnu.org, andrewjmoreton@HIDDEN
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: -6.0 (------)

> From: Noam Postavsky <npostavs@HIDDEN>
> Cc: Andy Moreton <andrewjmoreton@HIDDEN>,  32257 <at> debbugs.gnu.org
> Date: Fri, 27 Jul 2018 08:45:03 -0400
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> From: Andy Moreton <andrewjmoreton@HIDDEN>
> >> Date: Fri, 27 Jul 2018 12:35:27 +0100
> >> 
> >> > If we want this change on emacs-26, we should carefully audit all the
> >> > other users of rmc.el
> 
> What should we check for though?

Anything that read-event handles differently from read-char.  Maybe a
good starting point is to compile a list of the differences in
behavior between the two.

> >> read-multiple choice only has two callers (`nsm-query-user' and
> >> `message-fix-before-sending') in both master and emacs-26.
> >
> > In Emacs, yes.  But what about the world out there?
> 
> I expect all the callers out in the world will exhibit the same bug.

What about the features they expect?

> At any rate, I don't see a way of fixing it in the caller, short of
> temporarily fsetting read-char into read-event.

If there's no better idea, we could copy read-multiple-choice into
nsm.el and replace read-char with read-event there.  But maybe there
are more elegant ideas.

> Also, read-multiple-choice is new in Emacs 26, so it seems to me we
> should rather fix it in 26.2.

I agree, I just am not convince that replacing read-char with
read-event is the right fix.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#32257; Package emacs. Full text available.

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


Received: (at 32257) by debbugs.gnu.org; 27 Jul 2018 12:45:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 27 08:45:16 2018
Received: from localhost ([127.0.0.1]:59705 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fj27Q-0004Rd-GF
	for submit <at> debbugs.gnu.org; Fri, 27 Jul 2018 08:45:16 -0400
Received: from mail-it0-f53.google.com ([209.85.214.53]:54795)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1fj27L-0004RL-Ap
 for 32257 <at> debbugs.gnu.org; Fri, 27 Jul 2018 08:45:13 -0400
Received: by mail-it0-f53.google.com with SMTP id s7-v6so7322272itb.4
 for <32257 <at> debbugs.gnu.org>; Fri, 27 Jul 2018 05:45:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=hXrFDDRlzmndZOqzECM3IxzU2FDNPE3HDt68qDs4Sp0=;
 b=HWUns7d2qULw6i9qDTJxAQ6ADuPNVJLpFcRGE8PyWQez/wA017SxoZIzQoXquFNX8R
 FNQSMy/Vicn2WTzr49QV3koDnfVX6lh85tlEy9a5rkAmS6Zc8OCgFDscipP/jsONEPaT
 a89GlJTeiDIJZi41FNjk8HvYSXD4VeMSGsEUMB2bHc38zufLuvx709A/+vV2hEXCC8BB
 tWGa6oDmHgLrVMON3RBH0tSbxfjrgZrxi3gETqskzWj6DlNReeLASrRZcTFt+cwBEDFW
 h8qt8IgjvU/vGs9g25sQHpuTwPYmxsjEgc3EfC2RxDWIiI+SpLhNEYe4ZK4AKvy3AA90
 HUmQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=hXrFDDRlzmndZOqzECM3IxzU2FDNPE3HDt68qDs4Sp0=;
 b=joZxElgWc1CynzWIetYAgEbdfuCrEJaLQB26ELk0IDqC+vh8lNrfB72TkX6WfLCp4I
 oSbrFoYwcvErnFWJ93rbWV0dV5J76LenK+eLjfAYL0ufgJvxGagQ8HDLrDyGOFnkgDjI
 he/NTeUTa95FNgya8AKPJudmQsotv+NfQNFZvt4EMfwsrT/3z01/hyW27qbcEGoV17AX
 bZaTAo2ALkXUgM+qK0e1SV/348n1gNC9RCx2mWvr2IcsOPmFEW+o7ZML2DgS94COrqmM
 mvzH9Ll1pYyo/f2EHGeAXws4hf4f4Byul8pR2xqWUyOt0rdpUJAzUvIohdtBxru5l1BD
 wYrg==
X-Gm-Message-State: AOUpUlF+vMtzY6c5VelN20hfqoWI5vNR7DOpHG7cfSbdPObIv6g+oOBd
 ksxKduAW/QNeGl+nZt0+WH80wFca
X-Google-Smtp-Source: AAOMgpeW3/Sl1+SitSxCsCZom1+7qms8aN6/Jk024kbtCuLiiL6BIefQ3rIrolVhWsrIInKNO2Hcpw==
X-Received: by 2002:a24:eec7:: with SMTP id
 b190-v6mr5632029iti.32.1532695505342; 
 Fri, 27 Jul 2018 05:45:05 -0700 (PDT)
Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.googlemail.com with ESMTPSA id
 p70-v6sm2727122itb.3.2018.07.27.05.45.04
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 27 Jul 2018 05:45:04 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
References: <87muug4z52.fsf@HIDDEN> <87y3dy3i05.fsf@HIDDEN>
 <83muudrqol.fsf@HIDDEN> <vz136w43o8w.fsf@HIDDEN>
 <83effosvx2.fsf@HIDDEN>
Date: Fri, 27 Jul 2018 08:45:03 -0400
In-Reply-To: <83effosvx2.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 27 Jul
 2018 15:30:33 +0300")
Message-ID: <87r2jo3l0w.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 32257
Cc: 32257 <at> debbugs.gnu.org, Andy Moreton <andrewjmoreton@HIDDEN>
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 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Andy Moreton <andrewjmoreton@HIDDEN>
>> Date: Fri, 27 Jul 2018 12:35:27 +0100
>> 
>> > If we want this change on emacs-26, we should carefully audit all the
>> > other users of rmc.el

What should we check for though?

>> > (and in generally, I'd prefer some more local
>> > change in nsm.el on the release branch).  We've had our share of
>> > subtle bugs introduced by switching to an "almost-compatible" method
>> > of reading input.
>> 
>> read-multiple choice only has two callers (`nsm-query-user' and
>> `message-fix-before-sending') in both master and emacs-26.
>
> In Emacs, yes.  But what about the world out there?

I expect all the callers out in the world will exhibit the same bug.

> In case it wasn't clear I meant to make a safer change on emacs-26,
> and change read-multiple-choice on master.

At any rate, I don't see a way of fixing it in the caller, short of
temporarily fsetting read-char into read-event.  Also,
read-multiple-choice is new in Emacs 26, so it seems to me we should
rather fix it in 26.2.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#32257; Package emacs. Full text available.

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


Received: (at 32257) by debbugs.gnu.org; 27 Jul 2018 12:30:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 27 08:30:42 2018
Received: from localhost ([127.0.0.1]:59692 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fj1tK-000443-Lu
	for submit <at> debbugs.gnu.org; Fri, 27 Jul 2018 08:30:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42514)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1fj1tH-00043n-Cu
 for 32257 <at> debbugs.gnu.org; Fri, 27 Jul 2018 08:30:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1fj1tB-0004fj-HC
 for 32257 <at> debbugs.gnu.org; Fri, 27 Jul 2018 08:30:34 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:58415)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1fj1tB-0004fb-D1; Fri, 27 Jul 2018 08:30:33 -0400
Received: from [176.228.60.248] (port=2931 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1fj1tA-0007ly-2g; Fri, 27 Jul 2018 08:30:32 -0400
Date: Fri, 27 Jul 2018 15:30:33 +0300
Message-Id: <83effosvx2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Andy Moreton <andrewjmoreton@HIDDEN>
In-reply-to: <vz136w43o8w.fsf@HIDDEN> (message from Andy Moreton on Fri, 27
 Jul 2018 12:35:27 +0100)
Subject: Re: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
References: <87muug4z52.fsf@HIDDEN> <87y3dy3i05.fsf@HIDDEN>
 <83muudrqol.fsf@HIDDEN> <vz136w43o8w.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 32257
Cc: 32257 <at> debbugs.gnu.org
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: -6.0 (------)

> From: Andy Moreton <andrewjmoreton@HIDDEN>
> Date: Fri, 27 Jul 2018 12:35:27 +0100
> 
> > If we want this change on emacs-26, we should carefully audit all the
> > other users of rmc.el (and in generally, I'd prefer some more local
> > change in nsm.el on the release branch).  We've had our share of
> > subtle bugs introduced by switching to an "almost-compatible" method
> > of reading input.
> 
> read-multiple choice only has two callers (`nsm-query-user' and
> `message-fix-before-sending') in both master and emacs-26.

In Emacs, yes.  But what about the world out there?

> While I understand caution over changes to emacs-26, the only place that
> needs fixing is read-multiple-choice. It seems odd to prefer changes
> in its callers, that will more likely introduce additional bugs without
> fixing the original issue.

In case it wasn't clear I meant to make a safer change on emacs-26,
and change read-multiple-choice on master.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#32257; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 27 Jul 2018 11:36:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 27 07:36:03 2018
Received: from localhost ([127.0.0.1]:59661 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fj12O-0002eJ-3R
	for submit <at> debbugs.gnu.org; Fri, 27 Jul 2018 07:36:03 -0400
Received: from eggs.gnu.org ([208.118.235.92]:59924)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fj12J-0002dz-I5
 for submit <at> debbugs.gnu.org; Fri, 27 Jul 2018 07:35:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fj12A-0003Ge-15
 for submit <at> debbugs.gnu.org; Fri, 27 Jul 2018 07:35:50 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:60794)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1fj129-0003GW-T2
 for submit <at> debbugs.gnu.org; Fri, 27 Jul 2018 07:35:45 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:50849)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fj125-0005Nu-Hz
 for bug-gnu-emacs@HIDDEN; Fri, 27 Jul 2018 07:35:45 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fj120-0003Fe-Ov
 for bug-gnu-emacs@HIDDEN; Fri, 27 Jul 2018 07:35:41 -0400
Received: from [195.159.176.226] (port=56754 helo=blaine.gmane.org)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <geb-bug-gnu-emacs@HIDDEN>)
 id 1fj120-0003Ep-3O
 for bug-gnu-emacs@HIDDEN; Fri, 27 Jul 2018 07:35:36 -0400
Received: from list by blaine.gmane.org with local (Exim 4.84_2)
 (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1fj0zq-0006bS-3P
 for bug-gnu-emacs@HIDDEN; Fri, 27 Jul 2018 13:33:22 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Andy Moreton <andrewjmoreton@HIDDEN>
Subject: Re: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
Date: Fri, 27 Jul 2018 12:35:27 +0100
Lines: 56
Message-ID: <vz136w43o8w.fsf@HIDDEN>
References: <87muug4z52.fsf@HIDDEN> <87y3dy3i05.fsf@HIDDEN>
 <83muudrqol.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: usenet@HIDDEN
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (windows-nt)
Cancel-Lock: sha1:rpNRw/F7BxiEx+1Rq8JHf7CcoaI=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.5 (----)
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: -5.5 (-----)

On Fri 27 Jul 2018, Eli Zaretskii wrote:

>> From: Noam Postavsky <npostavs@HIDDEN>
>> Date: Wed, 25 Jul 2018 21:25:46 -0400
>> Cc: lars ingebrigtsen <larsi@HIDDEN>, andy moreton <andrewjmoreton@HIDDEN>
>> > Starting from emacs -Q, evaluate:
>> >
>> >     (require 'rmc)
>> >     (read-multiple-choice "choice? " '((?a "ay") (?b "bee") (?c "see")))
>> >
>> > then click the mouse somewhere instead of answering the prompt, notice
>> > Emacs maxing out CPU, hit C-g.  *Messages* will have a log of the prompt
>> > being repeated many times:
>> >
>> >     choice?  (ay, bee, [c] see, ?):  [4435 times]
>> 
>> The problem seems to be that read-char doesn't "use up" non-character
>> events, e.g., with the following:
>> 
>> (defun read-char-or-err ()
>>   (condition-case err
>>       (read-char)
>>     (error err)))
>> 
>> (list (read-char-or-err)
>>       (read-char-or-err)
>>       (read-char-or-err)
>>       (read-char-or-err)
>>       (read-char-or-err))
>> 
>> this returns ((error "Non-character input-event") (error "Non-character
>> input-event") ...) regardless of how many calls to read-char-or-err
>> there are.
>> 
>> The patch below fixes the inf looping, although it still doesn't allow
>> any other user interaction (unlike read-from-minibuffer).

I've tested this on emacs-26, and it fixes the original problem from NSM
that resulted in this bug report.

> If we want this change on emacs-26, we should carefully audit all the
> other users of rmc.el (and in generally, I'd prefer some more local
> change in nsm.el on the release branch).  We've had our share of
> subtle bugs introduced by switching to an "almost-compatible" method
> of reading input.

read-multiple choice only has two callers (`nsm-query-user' and
`message-fix-before-sending') in both master and emacs-26.

While I understand caution over changes to emacs-26, the only place that
needs fixing is read-multiple-choice. It seems odd to prefer changes
in its callers, that will more likely introduce additional bugs without
fixing the original issue.

    AndyM






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#32257; Package emacs. Full text available.

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


Received: (at 32257) by debbugs.gnu.org; 27 Jul 2018 09:09:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 27 05:09:34 2018
Received: from localhost ([127.0.0.1]:59545 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fiykc-0003W7-GJ
	for submit <at> debbugs.gnu.org; Fri, 27 Jul 2018 05:09:34 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57579)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1fiykW-0003Vl-QK
 for 32257 <at> debbugs.gnu.org; Fri, 27 Jul 2018 05:09:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1fiykN-0002dq-3b
 for 32257 <at> debbugs.gnu.org; Fri, 27 Jul 2018 05:09:19 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled
 version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44144)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1fiyk6-0002ZK-Eb; Fri, 27 Jul 2018 05:08:58 -0400
Received: from [176.228.60.248] (port=2529 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1fiyk5-0005YH-RV; Fri, 27 Jul 2018 05:08:58 -0400
Date: Fri, 27 Jul 2018 12:08:58 +0300
Message-Id: <83muudrqol.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Noam Postavsky <npostavs@HIDDEN>
In-reply-to: <87y3dy3i05.fsf@HIDDEN> (message from Noam Postavsky on Wed,
 25 Jul 2018 21:25:46 -0400)
Subject: Re: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
References: <87muug4z52.fsf@HIDDEN> <87y3dy3i05.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 32257
Cc: andrewjmoreton@HIDDEN, larsi@HIDDEN, 32257 <at> debbugs.gnu.org
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: -6.0 (------)

> From: Noam Postavsky <npostavs@HIDDEN>
> Date: Wed, 25 Jul 2018 21:25:46 -0400
> Cc: lars ingebrigtsen <larsi@HIDDEN>, andy moreton <andrewjmoreton@HIDDEN>
> > Starting from emacs -Q, evaluate:
> >
> >     (require 'rmc)
> >     (read-multiple-choice "choice? " '((?a "ay") (?b "bee") (?c "see")))
> >
> > then click the mouse somewhere instead of answering the prompt, notice
> > Emacs maxing out CPU, hit C-g.  *Messages* will have a log of the prompt
> > being repeated many times:
> >
> >     choice?  (ay, bee, [c] see, ?):  [4435 times]
> 
> The problem seems to be that read-char doesn't "use up" non-character
> events, e.g., with the following:
> 
> (defun read-char-or-err ()
>   (condition-case err
>       (read-char)
>     (error err)))
> 
> (list (read-char-or-err)
>       (read-char-or-err)
>       (read-char-or-err)
>       (read-char-or-err)
>       (read-char-or-err))
> 
> this returns ((error "Non-character input-event") (error "Non-character
> input-event") ...) regardless of how many calls to read-char-or-err
> there are.
> 
> The patch below fixes the inf looping, although it still doesn't allow
> any other user interaction (unlike read-from-minibuffer).

If we want this change on emacs-26, we should carefully audit all the
other users of rmc.el (and in generally, I'd prefer some more local
change in nsm.el on the release branch).  We've had our share of
subtle bugs introduced by switching to an "almost-compatible" method
of reading input.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#32257; Package emacs. Full text available.

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


Received: (at 32257) by debbugs.gnu.org; 26 Jul 2018 01:26:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 25 21:26:03 2018
Received: from localhost ([127.0.0.1]:57901 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fiV2V-0001uw-D0
	for submit <at> debbugs.gnu.org; Wed, 25 Jul 2018 21:26:03 -0400
Received: from mail-io0-f172.google.com ([209.85.223.172]:37846)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1fiV2P-0001ud-TH
 for 32257 <at> debbugs.gnu.org; Wed, 25 Jul 2018 21:25:58 -0400
Received: by mail-io0-f172.google.com with SMTP id z19-v6so54200ioh.4
 for <32257 <at> debbugs.gnu.org>; Wed, 25 Jul 2018 18:25:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=OGevfoWQMzyqkflxcsymKQyqYoJntqeY4Wc1vt/wtoQ=;
 b=AeShoWjcTM7KnqHPSwmPOFHCkRxWiv5tL213dhuDZUrAiGT0NbGeJ64SqKNoDOjITF
 toNK0CSr0YeMQrdbSENPbi2e1hlNcxhWFum6aLJqGf7lqMHmi00ZKcXGTSJF8eiQ/ZTQ
 5lvtk3D0iscPSsoVWqKCJbvE+/S1s8/kvExnAfBN1rwR4u2aEycvFJzg8pbOi6gTNTAu
 WUDZYJcIvM/o1Bberx+HrhpEEqah8G50rkFGTzOtwhIK6YmTLzRZowuu9xaa114ui41J
 jXbaKotQzcFZk/9RiIKH38FjOhZbi14YJeE/NURBCsRO+vRFAHBTcC7JnKa1mmpehuZX
 u8Dw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=OGevfoWQMzyqkflxcsymKQyqYoJntqeY4Wc1vt/wtoQ=;
 b=S4GDSdqvEZee/l5zAqsml7SclMkySBp7OGiTTQqVuFhAc7/jsAwBMu6tgEQj9pNogC
 bdIyTCDJX0BMYBAppztsD8Y057Fj/hlcx8gCfSj00V3R3NMkRpWBH0PfCSI5EZcbk0jN
 2Koa3TuSVYsSNEPlur5kXO2VrZAhLhaG704nVHxVhfdimHtL/hyUP2c38Rtb6dW64skl
 JPRdpVfVXsMXxF+LvqoaNSUT+I5YsJUC+pmGeV9mJhKwaxeasKnj9su6EDiKY1oeaVcu
 V66Y69+/KwcqDV0tFkoqbBgVBOkU4N27/qZOlAXqqkwcJlhlzygMw8jKCD7OYrqLzMs8
 xWgg==
X-Gm-Message-State: AOUpUlEQNMrBVJ9Fh/mRW69IkFmvS7UEADarlnzBFXEehUPYGjqQNVDA
 mox+HJYJ+O/259jx6tfBM1E=
X-Google-Smtp-Source: AAOMgpdGmqkjl3DEp4kdVebFtyCmPq0C0Nlxpx5bHY4WuGAzsIRs7pMDv2z31J31Zs4srJfBHSqm0A==
X-Received: by 2002:a6b:dd01:: with SMTP id
 f1-v6mr18756836ioc.45.1532568348422; 
 Wed, 25 Jul 2018 18:25:48 -0700 (PDT)
Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.googlemail.com with ESMTPSA id
 i13-v6sm1591960iog.31.2018.07.25.18.25.47
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 25 Jul 2018 18:25:47 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: 32257 <at> debbugs.gnu.org
Subject: Re: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
References: <87muug4z52.fsf@HIDDEN>
Date: Wed, 25 Jul 2018 21:25:46 -0400
In-Reply-To: <87muug4z52.fsf@HIDDEN> (Noam Postavsky's message of "Tue, 24
 Jul 2018 08:05:45 -0400")
Message-ID: <87y3dy3i05.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 32257
Cc: lars ingebrigtsen <larsi@HIDDEN>, andy moreton <andrewjmoreton@HIDDEN>
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 (-)

Noam Postavsky <npostavs@HIDDEN> writes:

> X-Debbugs-CC: Andy Moreton <andrewjmoreton@HIDDEN>, Lars Ingebrigtsen <larsi@HIDDEN>
>
> Starting from emacs -Q, evaluate:
>
>     (require 'rmc)
>     (read-multiple-choice "choice? " '((?a "ay") (?b "bee") (?c "see")))
>
> then click the mouse somewhere instead of answering the prompt, notice
> Emacs maxing out CPU, hit C-g.  *Messages* will have a log of the prompt
> being repeated many times:
>
>     choice?  (ay, bee, [c] see, ?):  [4435 times]

The problem seems to be that read-char doesn't "use up" non-character
events, e.g., with the following:

(defun read-char-or-err ()
  (condition-case err
      (read-char)
    (error err)))

(list (read-char-or-err)
      (read-char-or-err)
      (read-char-or-err)
      (read-char-or-err)
      (read-char-or-err))

this returns ((error "Non-character input-event") (error "Non-character
input-event") ...) regardless of how many calls to read-char-or-err
there are.

The patch below fixes the inf looping, although it still doesn't allow
any other user interaction (unlike read-from-minibuffer).

--- i/lisp/emacs-lisp/rmc.el
+++ w/lisp/emacs-lisp/rmc.el
@@ -118,8 +118,10 @@ read-multiple-choice
                             choices)))
                   (condition-case nil
                       (let ((cursor-in-echo-area t))
-                        (read-char))
+                        (read-event))
                     (error nil))))
+          (unless (characterp tchar)
+            (setq tchar nil))
           (setq answer (lookup-key query-replace-map (vector tchar) t))
           (setq tchar
                 (cond






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#32257; Package emacs. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 24 Jul 2018 12:06:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 24 08:06:20 2018
Received: from localhost ([127.0.0.1]:54642 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1fhw52-00087c-JK
	for submit <at> debbugs.gnu.org; Tue, 24 Jul 2018 08:06:20 -0400
Received: from eggs.gnu.org ([208.118.235.92]:37177)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1fhw4w-00087B-Rv
 for submit <at> debbugs.gnu.org; Tue, 24 Jul 2018 08:06:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <npostavs@HIDDEN>) id 1fhw4n-0007mJ-Rh
 for submit <at> debbugs.gnu.org; Tue, 24 Jul 2018 08:06:05 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:48012)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <npostavs@HIDDEN>) id 1fhw4n-0007lD-OU
 for submit <at> debbugs.gnu.org; Tue, 24 Jul 2018 08:06:01 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56192)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <npostavs@HIDDEN>) id 1fhw4j-00050b-HA
 for bug-gnu-emacs@HIDDEN; Tue, 24 Jul 2018 08:06:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <npostavs@HIDDEN>) id 1fhw4Z-0007WN-Sm
 for bug-gnu-emacs@HIDDEN; Tue, 24 Jul 2018 08:05:56 -0400
Received: from mail-io0-x230.google.com ([2607:f8b0:4001:c06::230]:37635)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <npostavs@HIDDEN>) id 1fhw4Z-0007WA-Mm
 for bug-gnu-emacs@HIDDEN; Tue, 24 Jul 2018 08:05:47 -0400
Received: by mail-io0-x230.google.com with SMTP id z19-v6so3191973ioh.4
 for <bug-gnu-emacs@HIDDEN>; Tue, 24 Jul 2018 05:05:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=8XLnCXcqd1lU/suOoZBk6DCx8nm4KRqdZ3SneWBKao4=;
 b=RirKqXw4QUHJlFpLUQCBY+YazyemRHEqhGiCH4CEE2zYqkTPBNu0/PWCZahyo4PaHM
 yEw3K+dGTvJwD+aQxRNZMQIzu7hw0loI1QLayVNjHV4WD8AScJZ/ruAZx06oCnLHXPM4
 PChHd0en47aYzrfvyYxjxaeJgB5Qdpf7rhBO0kreR2AKR30MZiVXJgwNs+Jb3WlDWwZn
 sFNZ/NliRI7hn3ch4ZDlqnnw/w9YDtbIiVfpIMk/uQvtU8/ew61EFXwd/CVKCkO8SW40
 5ExWQo73NaAnq8MXI/6FY3/Rw218XPKAZYEVsbq9TMKywYot4vxTlHsTjoe7HbEBr7Jh
 FKgA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=8XLnCXcqd1lU/suOoZBk6DCx8nm4KRqdZ3SneWBKao4=;
 b=D4cBYJJN//myBO/iToqx1wF6aPsC9iV6EQS+ZlgvrgIDaTqqsZLutKqehsZd6ZROEz
 D3pq2zruSTlRESFw+UFA39PG69rbkZL/B5PViCWD2EhtiddPNqB3AWAxGhIA6W4P1VnZ
 pHG9eNT+pkdHWF180Bx7bSjGjo7NOzXquK48iY0q9idb5REAhOIDM0aOSPQzs8vqZ//6
 fY8SexMuF3yEv0dQFTqpuHYNOIbsmp5JDbv00b5V/9VYwBDhJgy8krxjz0DZHKoeNgp1
 aBzf36+jdY8CGgGWkwl6uQANMz52b9R7CMNFDNfpzQ6qmd6R2I7XIPVZbEsi6l3BSolU
 k8Mw==
X-Gm-Message-State: AOUpUlEiHHHWrfosZw7q1WwbBmW5hCHrquU0EZHH9OJr4b99TEX7qkfG
 EzQ1VzkdKrF3Qiv4jF2aZkU/KEm1
X-Google-Smtp-Source: AAOMgpfeE5APbmr96tQIigkxlxLVgW7NOGfbHLJBRXtI8YWStgvUvFwJ79u4PT233gQ4Wu6YB1+mOA==
X-Received: by 2002:a6b:7517:: with SMTP id
 l23-v6mr12156595ioh.89.1532433946901; 
 Tue, 24 Jul 2018 05:05:46 -0700 (PDT)
Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.googlemail.com with ESMTPSA id
 r139-v6sm909264ita.14.2018.07.24.05.05.46 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 24 Jul 2018 05:05:46 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 26.1; read-multiple-choice inf loops on mouse clicks
Date: Tue, 24 Jul 2018 08:05:45 -0400
Message-ID: <87muug4z52.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.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: -5.0 (-----)

X-Debbugs-CC: Andy Moreton <andrewjmoreton@HIDDEN>, Lars Ingebrigtsen <larsi@HIDDEN>

Starting from emacs -Q, evaluate:

    (require 'rmc)
    (read-multiple-choice "choice? " '((?a "ay") (?b "bee") (?c "see")))

then click the mouse somewhere instead of answering the prompt, notice
Emacs maxing out CPU, hit C-g.  *Messages* will have a log of the prompt
being repeated many times:

    choice?  (ay, bee, [c] see, ?):  [4435 times]

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars)
 of 2018-04-09 built on zebian
Repository revision: c267421647510319d2a70554e42f0d1c394dba0a
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description:	Debian GNU/Linux 9.4 (stretch)




Acknowledgement sent to Noam Postavsky <npostavs@HIDDEN>:
New bug report received and forwarded. Copy sent to andrewjmoreton@HIDDEN, larsi@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to andrewjmoreton@HIDDEN, larsi@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#32257; 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: Tue, 31 Jul 2018 12:15:01 UTC

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