From unknown Sat Jun 21 10:24:47 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#3287 <3287@debbugs.gnu.org> To: bug#3287 <3287@debbugs.gnu.org> Subject: Status: GNU/Emacs bug when typed in prompt password fields using keypad Reply-To: bug#3287 <3287@debbugs.gnu.org> Date: Sat, 21 Jun 2025 17:24:47 +0000 retitle 3287 GNU/Emacs bug when typed in prompt password fields using keypad reassign 3287 emacs submitter 3287 Borja Tarraso Hueso severity 3287 normal thanks From borja.tarraso.hueso@googlemail.com Thu May 14 08:53:01 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 14 May 2009 15:53:01 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: ** X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=2.5 required=4.0 tests=FVGT_m_MULTI_ODD,MULTALT, PHONENUMBER autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n4EFqs3U012473 for ; Thu, 14 May 2009 08:52:55 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M4dEs-00035s-5V for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 11:52:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M4dEr-000354-D7 for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 11:52:53 -0400 Received: from [199.232.76.173] (port=47918 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M4dEr-00034z-Ar for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 11:52:53 -0400 Received: from fg-out-1718.google.com ([72.14.220.158]:28811) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M4dEq-0006np-EB for bug-gnu-emacs@gnu.org; Thu, 14 May 2009 11:52:53 -0400 Received: by fg-out-1718.google.com with SMTP id e12so437236fga.7 for ; Thu, 14 May 2009 08:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type; bh=VUTV1/tJr1cIZGyhyynUPr+k1o5n14l/w7DUaeH3VSw=; b=OFu0hzj7L1yFOOYVh/0lVW/PdORwyfGc+lw5ZfReGovfvVLeJ5J9KwADr6UxB9dcu2 cOupUfJeZtVeA8lYf8tVsTFfLdruYROkeNX1EgV2hOWb1ky49pQOB0dobEoIexaE9r38 vXJiun4A9GJgww8Kxu/7XzTl5hj7EGPqY3rks= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=q+Fz/iYqFxdeq3IuiFMKzdJfTUUYdw2S9wHRoeknP+gLq66jfOZa4niYTlfRusc/Bl kbJ4f6GN/i4LeDZ51bsm9HHUvnYe27k+fs9RWCj+WYXvV99iNKaSFvwKvM73zNNbX/n9 tdcvCrSwlJVXf+F2NQcJcALD5zlaPoXCiTPP4= MIME-Version: 1.0 Received: by 10.86.65.9 with SMTP id n9mr2637627fga.43.1242316371395; Thu, 14 May 2009 08:52:51 -0700 (PDT) Date: Thu, 14 May 2009 16:52:51 +0100 Message-ID: <1f62569f0905140852j553dbfbby7f00797d23988832@mail.gmail.com> Subject: GNU/Emacs bug when typed in prompt password fields using keypad From: Borja Tarraso Hueso To: bug-gnu-emacs@gnu.org Cc: monnier@iro.umontreal.ca Content-Type: multipart/alternative; boundary=000e0cd251520404ac0469e1526f X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) --000e0cd251520404ac0469e1526f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi people, I just found a bug when is used keypad under password input field in emacs, that's not doing anything, so these diffs provided by Stefan and slightly modified by us, to handle C-g case, fix the problem . ==> Bug: Under GNU/Linux trying to write numbers using keypad in a prompt input password field does not works. This is not happening under Windows OS. Not other OS tested. This is reproducible in any gnu/emacs version from cvs (e.g. 23.0.90.2). ==> Fix: Usage of read-key instead read-event. As read-key is getting each key but not inserted and handled until pressed return, so we should take care about C-g case as well to provide user's cancellation. ==> Diffs: *** emacs/lisp/subr.el 2009-02-14 09:06:56.000000000 +0000 --- emacs_hack/lisp/subr.el 2009-05-14 01:29:52.000000000 +0100 *************** *** 1721,1726 **** --- 1721,1767 ---- - Mostrar texto citado - ;;;; Input and display facilities. + (defconst read-key-empty-map (make-sparse-keymap)) + (defvar read-key-delay 0.1) + + (defun read-key (&optional prompt) + "Read a key from the keyboard. + Contrary to `read-event' this will not return a raw event but instead will + obey the input decoding and translations usually done by `read-key-sequence'. + So escape sequences and keyboard encoding are taken into account. + When there's an ambiguity because the key looks like the prefix of + some sort of escape sequence, the ambiguity is resolved via `read-key-delay'." + (let ((overriding-terminal-local-map read-key-empty-map) + (overriding-local-map nil) + (old-global-map (current-global-map)) + (timer (run-with-idle-timer + ;; Wait long enough that Emacs has the time to receive and + ;; process all the raw events associated with the single-key. + ;; But don't wait too long, or the user may find the delay + ;; annoying (or keep hitting more keys which may then get + ;; lost or misinterpreted). + ;; This is only relevant for keys which Emacs perceives as + ;; "prefixes", such as C-x (because of the C-x 8 map in + ;; key-translate-table and the C-x @ map in function-key-map) + ;; or ESC (because of terminal escape sequences in + ;; input-decode-map). + read-key-delay t + (lambda () + (let ((keys (this-command-keys-vector))) + (unless (zerop (length keys)) + ;; `keys' is non-empty, so the user has hit at least + ;; one key; there's no point waiting any longer, even + ;; though read-key-sequence thinks we should wait + ;; for more input to decide how to interpret the + ;; current input. + (throw 'read-key keys))))))) + (unwind-protect + (progn + (use-global-map read-key-empty-map) + (aref (catch 'read-key (read-key-sequence prompt nil t)) 0)) + (cancel-timer timer) + (use-global-map old-global-map)))) + (defvar read-quoted-char-radix 8 "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'. Legitimate radix values are 8, 10 and 16.") *************** *** 1837,1846 **** (while (progn (message "%s%s" prompt (make-string (length pass) ?.)) ! ;; We used to use read-char-exclusive, but that ! ;; gives funny behavior when the user presses, ! ;; e.g., the arrow keys. ! (setq c (read-event nil t)) (not (memq c stop-keys))) (clear-this-command-keys) (cond ((memq c rubout-keys) ; rubout --- 1878,1884 ---- (while (progn (message "%s%s" prompt (make-string (length pass) ?.)) ! (setq c (read-key)) (not (memq c stop-keys))) (clear-this-command-keys) (cond ((memq c rubout-keys) ; rubout *************** *** 1848,1855 **** (let ((new-pass (substring pass 0 -1))) (and (arrayp pass) (clear-string pass)) (setq pass new-pass)))) ((not (numberp c))) ! ((= c ?\C-u) ; kill line (and (arrayp pass) (clear-string pass)) (setq pass "")) ((= c ?\C-y) ; yank --- 1886,1895 ---- (let ((new-pass (substring pass 0 -1))) (and (arrayp pass) (clear-string pass)) (setq pass new-pass)))) + ((eq c ?\C-g) + (keyboard-quit)) ((not (numberp c))) ! ((eq c ?\C-u) ; kill line (and (arrayp pass) (clear-string pass)) (setq pass "")) ((= c ?\C-y) ; yank ==> End. Thanks! Borja Tarraso --000e0cd251520404ac0469e1526f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi people,

I just found a bug when is used keypad under password inp= ut field in emacs, that's not doing anything, so these diffs provided b= y Stefan and slightly modified by us, to handle C-g case, fix the problem.

=3D=3D> Bug:

Under GNU/Linux trying to write numbers using ke= ypad in a prompt input password field does not works. This is not happening= under Windows OS. Not other OS tested.

This is reproducible in any = gnu/emacs version from cvs (e.g. 23.0.90.2).

=3D=3D> Fix:

Usage of read-key instead read-event. As read-ke= y is getting each key but not inserted and handled until pressed return, so= we should take care about C-g case as well to provide user's cancellat= ion.

=3D=3D> Diffs:

*** emacs/lisp/subr.el =A02009-02-14 09:06:56.000000000 +0000
--- emacs_hack/lisp/subr.el =A0 =A0 2009-05-14 01:29:52.000000000 +0100
***************
*** 1721,1726 ****
--- 1721,1767 ----
- Mostrar texto ci= tado -


=A0;;;; Input and display facilities.

+ (defconst read-key-empty-map (make-sparse-keymap))
+ (defvar read-key-delay 0.1)
+
+ (defun read-key (&optional prompt)
+ =A0 "Read a key from the keyboard.
+ Contrary to `read-event' this will not return a raw event but instead= will
+ obey the input decoding and translations usually done by `read-key-sequen= ce'.
+ So escape sequences and keyboard encoding are taken into account.
+ When there's an ambiguity because the key looks like the prefix of + some sort of escape sequence, the ambiguity is resolved via `read-key-del= ay'."
+ =A0 (let ((overriding-terminal-local-map read-key-empty-map)
+ =A0 =A0 =A0 (overriding-local-map nil)
+ =A0 =A0 =A0 (old-global-map (current-global-map))
+ =A0 =A0 =A0 =A0 (timer (run-with-idle-timer
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; Wait long enough that Emacs has the ti= me to receive and
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; process all the raw events associated = with the single-key.
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; But don't wait too long, or the us= er may find the delay
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; annoying (or keep hitting more keys wh= ich may then get
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; lost or misinterpreted).
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; This is only relevant for keys which E= macs perceives as
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; "prefixes", such as C-x (bec= ause of the C-x 8 map in
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; key-translate-table and the C-x @ map = in function-key-map)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; or ESC (because of terminal escape seq= uences in
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; input-decode-map).
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 read-key-delay t
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (lambda ()
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (let ((keys (this-command-keys-vector= )))
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (unless (zerop (length keys))
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; `keys' is non-empty, s= o the user has hit at least
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; one key; there's no po= int waiting any longer, even
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; though read-key-sequence t= hinks we should wait
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; for more input to decide h= ow to interpret the
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; current input.
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (throw 'read-key keys))))= )))
+ =A0 =A0 (unwind-protect
+ =A0 =A0 =A0 =A0 (progn
+ =A0 =A0 =A0 =A0 (use-global-map read-key-empty-map)
+ =A0 =A0 =A0 =A0 (aref (catch 'read-key (read-key-sequence prompt nil = t)) 0))
+ =A0 =A0 =A0 (cancel-timer timer)
+ =A0 =A0 =A0 (use-global-map old-global-map))))
+
=A0(defvar read-quoted-char-radix 8
=A0 =A0"*Radix for \\[quoted-insert] and other uses of `read-quoted-c= har'.
=A0Legitimate radix values are 8, 10 and 16.")
***************
*** 1837,1846 ****
=A0 =A0 =A0 =A0(while (progn (message "%s%s" =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prompt
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (make-string (= length pass) ?.))
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; We used to use read-char-exclu= sive, but that
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; gives funny behavior when the = user presses,
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ;; e.g., the arrow keys.
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq c (read-event nil t))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(not (m= emq c stop-keys)))
=A0 =A0 =A0 =A0 =A0(clear-this-command-keys)
=A0 =A0 =A0 =A0 =A0(cond ((memq c rubout-keys) ; rubout
--- 1878,1884 ----
=A0 =A0 =A0 =A0(while (progn (message "%s%s" =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prompt
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (make-string (= length pass) ?.))
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq c (read-key))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(not (memq c = stop-keys)))
=A0 =A0 =A0 =A0 =A0(clear-this-command-keys)
=A0 =A0 =A0 =A0 =A0(cond ((memq c rubout-keys) ; rubout
***************
*** 1848,1855 ****
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (let ((new-pass (substring pass 0 -1))= )
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (and (arrayp pas= s) (clear-string pass))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq pass new-pass))))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0((not (numberp c)))
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((=3D c ?\C-u) ; kill line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (and (arrayp pass) (clear-string pass))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq pass ""))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0((=3D c ?\C-y) ; yank
--- 1886,1895 ----
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (let ((new-pass (substring pass 0 -1))= )
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (and (arrayp pas= s) (clear-string pass))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq pass new-pass))))
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((eq c ?\C-g)
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(keyboard-quit))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0((not (numberp c)))
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 ((eq c ?\C-u) ; kill line
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (and (arrayp pass) (clea= r-string pass))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (setq pass ""))
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0((=3D c ?\C-y) ; yank


=3D=3D> End.

Thanks!

Borja Tarraso


--000e0cd251520404ac0469e1526f-- From monnier@iro.umontreal.ca Wed Aug 19 12:48:15 2009 Received: (at 3287-done) by emacsbugs.donarmstrong.com; 19 Aug 2009 19:48:16 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-0.2 required=4.0 tests=AWL,FAKE_REPLY_C, MURPHY_DRUGS_REL8 autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.teksavvy.com (ironport2-out.pppoe.ca [206.248.154.182]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7JJmDg7008021 for <3287-done@emacsbugs.donarmstrong.com>; Wed, 19 Aug 2009 12:48:15 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ar0EAFfzi0pFpaKZ/2dsb2JhbACBU8RYkR+CUoFIBYdP X-IronPort-AV: E=Sophos;i="4.43,410,1246852800"; d="scan'208";a="43811138" Received: from 69-165-162-153.dsl.teksavvy.com (HELO pastel.home) ([69.165.162.153]) by ironport2-out.teksavvy.com with ESMTP; 19 Aug 2009 15:47:31 -0400 Received: by pastel.home (Postfix, from userid 20848) id 8063D82F0; Wed, 19 Aug 2009 15:48:07 -0400 (EDT) From: Stefan Monnier To: Borja Tarraso Hueso Subject: Re: GNU/Emacs bug when typed in prompt password fields using keypad Message-ID: Date: Wed, 19 Aug 2009 15:48:07 -0400 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I've just installed a patch that uses read-key into the CVS trunk. So, I believe the problem is now fixed, Stefan From unknown Sat Jun 21 10:24:47 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 18 Sep 2009 14:24:17 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator