GNU bug report logs - #43003
28.0.50; comint-password-prompt-regexp too restrictive

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Sun, 23 Aug 2020 21:27:01 UTC

Severity: normal

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #34 received at 43003 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 43003 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#43003: 28.0.50; comint-password-prompt-regexp too restrictive
Date: Mon, 31 Aug 2020 12:11:54 +0200
>>>>> On Mon, 31 Aug 2020 11:26:10 +0200, Stephen Berman <stephen.berman <at> gmx.net> said:

    Stephen> On Sun, 30 Aug 2020 15:41:57 +0200 Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
    >> Stephen Berman <stephen.berman <at> gmx.net> writes:
    >> 
    >>> True, I wasn't thinking about that.  Then I guess it's best to leave
    >>> comint-password-prompt-regexp as is and I'll just change it locally.
    >>> The problem I have with it doesn't seem to be widespread, to say the
    >>> least.  So feel free to close the bug.
    >> 
    >> OK; done.

    Stephen> A postscript with additional datapoints: In my OP, the the system that
    Stephen> the problem occurs on (Linux From Scratch) uses openssh 8.2p1, while the
    Stephen> system without the problem (an older Linux From Scratch) uses openssh
    Stephen> 7.9p1.  I've now reproduced the problem on two other GNU/Linux systems:
    Stephen> current openSUSE Tumbleweed, which uses openssh 8.3p1 (and I see the
    Stephen> problem here on two different machines), and openSUSE Leap 15.2, which
    Stephen> uses openssh 8.1p1.  This supports my conjecture that the problematic
    Stephen> carriage return in the prompt comes from openssh.  If anyone else
    Stephen> running a system with openssh 8.{1,2,3}p1 can reproduce the problem,
    Stephen> then perhaps a different way of handling it than changing the default
    Stephen> value of comint-password-prompt-regexp can be found.

That matches the analysis done in

https://emacs.stackexchange.com/questions/60394/unable-to-push-into-github-using-magit

which leads to:

https://github.com/magit/magit/issues/3843

TL;DR magit decided to strip the \r from the prompt received from
openssh.

We could strip control characters in comint-watch-for-password-prompt,
but then people who've legitimately put control characters in
comint-password-prompt-regexp will get annoyed.

Perhaps just strip '\r'? (And document it, of course)

diff --git a/lisp/comint.el b/lisp/comint.el
index be0e32b9e0..74c5c7f94f 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2427,7 +2427,8 @@ comint-watch-for-password-prompt
 
 This function could be in the list `comint-output-filter-functions'."
   (when (let ((case-fold-search t))
-	  (string-match comint-password-prompt-regexp string))
+	  (string-match comint-password-prompt-regexp
+                        (replace-regexp-in-string "\r" "" string)))
     (when (string-match "^[ \n\r\t\v\f\b\a]+" string)
       (setq string (replace-match "" t t string)))
     (let ((comint--prompt-recursion-depth (1+ comint--prompt-recursion-depth)))






This bug report was last modified 4 years and 347 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.