Subject: read-passwd deletes prompt
From: Juri Linkov <[email-masked]>
To: [email-masked]
Date: Thu, 02 Aug 2012 11:07:06 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

A new implementation of `read-passwd' allows the user to delete
characters from the minibuffer's prompt, i.e. when the user
mistypes the password and wants to retype it after clearing with
a few of DELs, typing more DEL will start removing characters
from the prompt.

This can be reproduced by visiting a GPG encrypted file that uses
`epa-passphrase-callback-function' that calls `read-passwd'.

The problem is that `find-file-noselect-1' binds `inhibit-read-only' to t
before calling `insert-file-contents':

            (let ((inhibit-read-only t))
              (insert-file-contents filename t))

The simplest test case to demonstrate the problem is to type DEL
after evaluating:

  (let ((inhibit-read-only t))
    (read-passwd "Password: "))

What is expected is: instead of deleting characters from the prompt
DEL should display the message "Text is read-only".

One solution is to let-bind `inhibit-read-only' to nil either
in `read-passwd' or in `epa-passphrase-callback-function',
or maybe in both?