public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Emacs-w32/X11 doesn't echo periods when typing in password for TRAMP
@ 2013-11-26  1:59 SDS
  2013-11-26 15:39 ` Ken Brown
  0 siblings, 1 reply; 2+ messages in thread
From: SDS @ 2013-11-26  1:59 UTC (permalink / raw)
  To: cygwin

When I'm prompted for a password while accessing a remote directory 
using TRAMP in Emacs, sometimes the password isn't hidden (i.e. periods 
aren't echoed in the minibuffer, but the actual password is echoed 
instead).

I ran the Emacs Lisp debugger in the minibuffer while this happened and 
it gave me the following:

> Debugger entered: nil
>   ...
>   read-string("Password for /method:username@hostname: " nil t nil)
>   read-passwd("Password for /method:username@hostname: ")
>   password-read("Password for /method:username@hostname: " "/method:username@hostname:")
>   ...

When I looked at the function definitions, the definition for 
read-passwd in subr.el stood out:

> (defun read-passwd (prompt &optional confirm default)
>   "Read a password, prompting with PROMPT, and return it.
> If optional CONFIRM is non-nil, read the password twice to make sure.
> Optional DEFAULT is a default password to use instead of empty input.
>
> This function echoes `.' for each character that the user types.
>
> Once the caller uses the password, it can erase the password
> by doing (clear-string STRING)."
>   (if confirm
>       (let (success)
>         (while (not success)
>           (let ((first (read-passwd prompt nil default))
>                 (second (read-passwd "Confirm password: " nil default)))
>             (if (equal first second)
>                 (progn
>                   (and (arrayp second) (clear-string second))
>                   (setq success first))
>               (and (arrayp first) (clear-string first))
>               (and (arrayp second) (clear-string second))
>               (message "Password not repeated accurately; please start over")
>               (sit-for 1))))
>         success)
>     (let ((hide-chars-fun
>            (lambda (beg end _len)
>              (clear-this-command-keys)
>              (setq beg (min end (max (minibuffer-prompt-end)
>                                      beg)))
>              (dotimes (i (- end beg))
>                (put-text-property (+ i beg) (+ 1 i beg)
>                                   'display (string ?.)))))
>           minibuf)
>       (minibuffer-with-setup-hook
>           (lambda ()
>             (setq minibuf (current-buffer))
>             ;; Turn off electricity.
>             (setq-local post-self-insert-hook nil)
>             (setq-local buffer-undo-list t)
>             (setq-local select-active-regions nil)
>             (use-local-map read-passwd-map)
>             (add-hook 'after-change-functions hide-chars-fun nil 'local))
>         (unwind-protect
>             (let ((enable-recursive-minibuffers t))
>               (read-string prompt nil t default)) ; t = "no history"
>           (when (buffer-live-p minibuf)
>             (with-current-buffer minibuf
>               ;; Not sure why but it seems that there might be cases where the
>               ;; minibuffer is not always properly reset later on, so undo
>               ;; whatever we've done here (bug#11392).
>               (remove-hook 'after-change-functions hide-chars-fun 'local)
>               (kill-local-variable 'post-self-insert-hook)
>               ;; And of course, don't keep the sensitive data around.
>               (erase-buffer))))))))

I don't know Lisp, so I'm not sure precisely what's causing this.

The good news is that the bug happens predictably. The instructions for 
reproducing the bug are below. It works for both emacs-X11 and 
emacs-w32, both run with the -q flag. However, the bug disappears if run 
with the -Q flag.

1) Run "emacs-w32 -q" or "emacs-X11 -q" in bash.
2) Type "C-x d" for the "dired" command.
3) Type "/username@hostname:~/" at the Dired prompt. Don't omit the 
forward slash after the tilde -- omitting the forward slash makes the 
bug disappear.
4) Type <RET> and wait for the password prompt.
5) Type in the password, type <RET> and wait for the Dired buffer to 
load. The minibuffer should echo periods properly.
6) Type "C-x C-c" to exit Emacs.
7) Run "emacs-w32 -q" or "emacs-X11 -q" in bash. This does not have to 
be same version of Emacs as run in Step 1 -- using the other version 
will still produce the bug.
8) Type "C-x d" for the "dired" command.
9) Type "/username@hostname:~/" at the Dired prompt, exactly the same 
string as used in Step 3.
10) Type <RET> and wait for the password prompt.
11) Begin typing. The bug should appear, with the minibuffer echoing the 
password instead of periods.

Avoid typos when typing at the Dired prompt. I'm not sure whether it 
really matters, but I haven't tested whether typos affect reproducibility.

The output of cygcheck -s -v -r, with identifying information redacted, 
has already been uploaded to the mailing list here:

http://cygwin.com/ml/cygwin/2013-11/msg00303.html


Cheers,

SDS

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Emacs-w32/X11 doesn't echo periods when typing in password for TRAMP
  2013-11-26  1:59 Emacs-w32/X11 doesn't echo periods when typing in password for TRAMP SDS
@ 2013-11-26 15:39 ` Ken Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Ken Brown @ 2013-11-26 15:39 UTC (permalink / raw)
  To: cygwin

On 11/25/2013 8:59 PM, SDS wrote:
> When I'm prompted for a password while accessing a remote directory
> using TRAMP in Emacs, sometimes the password isn't hidden (i.e. periods
> aren't echoed in the minibuffer, but the actual password is echoed
> instead).
>
[...]

> The good news is that the bug happens predictably. The instructions for
> reproducing the bug are below. It works for both emacs-X11 and
> emacs-w32, both run with the -q flag. However, the bug disappears if run
> with the -Q flag.

I can't reproduce the problem.  The fact that it occurs with -q but not 
-Q suggests that the problem has something to do with your site 
initialization.  (-Q forces --no-site-file and --no-site-lisp.)  I 
suggest that you look in /usr/share/emacs/site-lisp to see if something 
there could be causing the problem.

Ken


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-26 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-26  1:59 Emacs-w32/X11 doesn't echo periods when typing in password for TRAMP SDS
2013-11-26 15:39 ` Ken Brown

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).