unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Andy Moreton <andrewjmoreton@gmail.com>
To: 32257@debbugs.gnu.org
Subject: bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks
Date: Fri, 27 Jul 2018 12:35:27 +0100	[thread overview]
Message-ID: <vz136w43o8w.fsf@gmail.com> (raw)
In-Reply-To: <87muug4z52.fsf@gmail.com>

On Fri 27 Jul 2018, Eli Zaretskii wrote:

>> From: Noam Postavsky <npostavs@gmail.com>
>> Date: Wed, 25 Jul 2018 21:25:46 -0400
>> Cc: lars ingebrigtsen <larsi@gnus.org>, andy moreton <andrewjmoreton@gmail.com>
>> > 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







  reply	other threads:[~2018-07-27 11:35 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-24 12:05 bug#32257: 26.1; read-multiple-choice inf loops on mouse clicks Noam Postavsky
2018-07-26  1:25 ` Noam Postavsky
2018-07-27  9:08   ` Eli Zaretskii
2018-07-27 11:35     ` Andy Moreton [this message]
2018-07-27 12:30       ` Eli Zaretskii
2018-07-27 12:45         ` Noam Postavsky
2018-07-27 13:50           ` Eli Zaretskii
2018-07-31  1:52             ` Noam Postavsky
2018-07-31 11:59               ` Andy Moreton
2018-07-31 12:27                 ` martin rudalics
2018-07-31 12:38                   ` Andy Moreton
2018-08-01  8:44                     ` martin rudalics
2018-08-01 12:30                       ` Noam Postavsky
2018-08-01 12:57                       ` Robert Pluim
2018-08-02  7:09                         ` martin rudalics
2018-08-01 20:55                       ` Live System User
2018-08-02  7:09                         ` martin rudalics
2018-07-31 16:06                 ` Eli Zaretskii
2018-07-31 19:26                   ` Andy Moreton
2018-08-01  5:27                     ` Eli Zaretskii
2018-07-31 16:04               ` Eli Zaretskii
2018-07-31 19:29                 ` Andy Moreton
2018-08-01  5:29                   ` Eli Zaretskii
2018-08-01 12:05                     ` Andy Moreton
2019-05-22  0:52                       ` Noam Postavsky
2019-05-22 10:08                         ` Eli Zaretskii
2019-05-26 12:57                           ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vz136w43o8w.fsf@gmail.com \
    --to=andrewjmoreton@gmail.com \
    --cc=32257@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).