Subject: Re: bug#51666: 28.0.60; comint-password-prompt-regexp too restrictive (again)

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 07 Nov 2021 21:33:33 +0100

Stephen Berman <[email-masked]> writes:

> On one of my systems, when using ssh in shell-mode (M-x shell), the
> password prompt does not appear in the minibuffer but only in the
> *shell* buffer directly under the ssh invocation, and the password is
> not hidden when it's entered.  The password prompt has this form:
>
> (user@host) Password:
>
> and comint-password-prompt-regexp fails to match it.  By contrast,
> eshell-password-prompt-regexp does match this prompt.  This is with
> openssh-8.6p1.  The fix in bug#43003 doesn't help here.

The following patch should fix the problem, but I'm a bit wary about
pushing it to Emacs 28, since these things may have unintended side
effects.

So I've pushed it to Emacs 29 instead.

diff --git a/lisp/comint.el b/lisp/comint.el
index c114bdf758..94e8e3b84b 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -385,7 +385,9 @@ comint-password-prompt-regexp
    "\\(?: [[:alpha:]]+ .+\\)?[[:blank:]]*[:：៖][[:space:]]*\\'"
    ;; The ccrypt encryption dialogue doesn't end with a colon, so
    ;; treat it specially.
-   "\\|^Enter encryption key: (repeat) *\\'")
+   "\\|^Enter encryption key: (repeat) *\\'"
+   ;; openssh-8.6p1 format: "(user@host) Password:".
+   "\\|^([^)@ \t\n]+@[^)@ \t\n]+) Password: *\\'")
   "Regexp matching prompts for passwords in the inferior process.
 This is used by `comint-watch-for-password-prompt'."
   :version "28.1"

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no