Subject: bug#43003: 28.0.50; comint-password-prompt-regexp too restrictive

From: Stephen Berman <[email-masked]>
Date: Wed, 26 Aug 2020 12:10:55 +0200

On Mon, 24 Aug 2020 14:27:41 +0200 Lars Ingebrigtsen <[email-masked]> wrote:

> Stephen Berman <[email-masked]> writes:
>
>> So this bug report is basically a plea to change the default value of
>> comint-password-prompt-regexp to be the same as that of
>> eshell-password-prompt-regexp.  Or is there a good reason not to do
>> this?
>
> The difference is that the former looks for something like "enter"
> before something like "password:", while the latter is just looking for
> variations of "password:"?
>
> My guess would be that the latter would have more false positives...
> but you'd think those would be pretty rare.  I can't imagine many people
> having shells with prompts like "Type your user name here but definitely
> not your password:".
>
> So I think replacing the former with the latter might work, but comint
> is very old code, so perhaps it supports older shells better here...

The minimal change to fix my use case is to add the carriage return
character as an alternative to comint-password-prompt-regexp, as in the
attached patch.  If even that is too risky, I'll just stick with a local
fix.

Steve

diff --git a/lisp/comint.el b/lisp/comint.el
index 092902d865..b6098f449d 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -365,7 +365,7 @@ comint-process-echoes
 ;; See ert test `comint-test-password-regexp'.
 (defcustom comint-password-prompt-regexp
   (concat
-   "\\(^ *\\|"
+   "\\(^ *\\|
"
    (regexp-opt
     '("Enter" "enter" "Enter same" "enter same" "Enter the" "enter the"
       "Enter Auth" "enter auth" "Old" "old" "New" "new" "'s" "login"