X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; q=dns; s=default; b=nD/ pGrEajqUxx/KRPyH3uO73DXxgNuTB90ooQDxy6XpzenOHfxKhjdrFd9u5X9DjOtK r5+fhMWMb95/4IKCqV51SLtnC9PEtwVxNeZAakMToM2JKJ/vP2zENV8zmkDE+yaT qJ2po+EjOnnsapU0/nt4cDsFFAmLFJW3WmJ0OF78= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :content-type:content-transfer-encoding; s=default; bh=az1l4IrUz z+gfocWjpVb5ZPR35M=; b=N8XjpZFVo+TOG+JCqgeDtbkaY0LqK650hssq1qxWw Rqnf1ulHzFvG71Zk6lskA+FvROH5s9NNx7JGbG85XLuNDmJx7goDYcuE0CUY0iCm 6pAqkPdi9MHfRtZG2zAIlsQ4AdFK4hJX5fPxVb/NYwO54EByaK/XsAuiGU3LDCYG BI= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.3 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RDNS_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail-yh0-f47.google.com X-Received: by 10.236.129.19 with SMTP id g19mr27781yhi.120.1385431163061; Mon, 25 Nov 2013 17:59:23 -0800 (PST) Message-ID: <52940078.90302@gmail.com> Date: Mon, 25 Nov 2013 20:59:20 -0500 From: SDS MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Emacs-w32/X11 doesn't echo periods when typing in password for TRAMP Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 AT hostname: " nil t nil) > read-passwd("Password for /method:username AT hostname: ") > password-read("Password for /method:username AT hostname: " "/method:username AT 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 AT hostname:~/" at the Dired prompt. Don't omit the forward slash after the tilde -- omitting the forward slash makes the bug disappear. 4) Type and wait for the password prompt. 5) Type in the password, type 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 AT hostname:~/" at the Dired prompt, exactly the same string as used in Step 3. 10) Type 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