GNU bug report logs - #51101
29.0.50; read-char-from-minibuffer accepts Enter even when not a choice.

Previous Next

Package: emacs;

Reported by: "David M. Koppelman" <koppel <at> ece.lsu.edu>

Date: Fri, 8 Oct 2021 20:20:01 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 28.0.60

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "David M. Koppelman" <koppel <at> ece.lsu.edu>
Cc: 51101 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: bug#51101: 29.0.50; read-char-from-minibuffer accepts Enter even when not a choice.
Date: Sat, 09 Oct 2021 15:09:24 +0200
"David M. Koppelman" <koppel <at> ece.lsu.edu> writes:

> Execute:
>
>  (read-char-from-minibuffer "Answer y or n" '(?y ?n))
>
> and press Enter. The form returns Enter (13) rather than re-prompting
> for a y or n.

It seems undocumented what RET is supposed to do in this function --
I've added Juri to the CCs, perhaps he has some comments.

> This causes a dataloss threat due to read-char-from-minibuffer being
> called through ask-user-about-supersession-threat.
>
> Even if the read-char-from-minibuffer bug is quickly fixed, I'd
> sleep better if the following patch were applied to userlock.el:
>
> @@ -194,7 +194,9 @@ ask-user-about-supersession-threat
>  		       (list "File reverted" filename)))
>  	      ((eq answer ?n)
>  	       (signal 'file-supersession
> -		       (list "File changed on disk" filename)))))
> +		       (list "File changed on disk" filename)))
> +              ((eq answer ?y))
> +              (t (setq answer nil))))

But I think ask-user-about-supersession-threat is working correctly here
already (almost by chance).  RET means "yes" in functions like
`y-or-n-p', which this is basically an extended version of, so it should
work as "yes" here, too.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 220 days ago.

Previous Next


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