unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Robert Pluim <rpluim@gmail.com>
Cc: 43003@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#43003: 28.0.50; comint-password-prompt-regexp too restrictive
Date: Mon, 31 Aug 2020 14:05:48 +0200	[thread overview]
Message-ID: <87imczf2ar.fsf@gmx.net> (raw)
In-Reply-To: <m24kojgm51.fsf@gmail.com> (Robert Pluim's message of "Mon, 31 Aug 2020 12:11:54 +0200")

On Mon, 31 Aug 2020 12:11:54 +0200 Robert Pluim <rpluim@gmail.com> wrote:

>>>>>> On Mon, 31 Aug 2020 11:26:10 +0200, Stephen Berman
> <stephen.berman@gmx.net> said:
>
>     Stephen> On Sun, 30 Aug 2020 15:41:57 +0200 Lars Ingebrigtsen
>     Stephen> <larsi@gnus.org> wrote:
>     >> Stephen Berman <stephen.berman@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.

Ah, thanks for the pointer.  I'd done a web search before my first post
about this but didn't find those pages.

> 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)))

That works for me.  Thanks,

Steve Berman





  reply	other threads:[~2020-08-31 12:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-23 21:26 bug#43003: 28.0.50; comint-password-prompt-regexp too restrictive Stephen Berman
2020-08-24 12:27 ` Lars Ingebrigtsen
2020-08-26 10:10   ` Stephen Berman
2020-08-27 13:02     ` Lars Ingebrigtsen
2020-08-27 15:09       ` Stephen Berman
2020-08-28 14:08         ` Lars Ingebrigtsen
2020-08-28 14:53           ` Stephen Berman
2020-08-30 13:41             ` Lars Ingebrigtsen
2020-08-31  9:26               ` Stephen Berman
2020-08-31 10:11                 ` Robert Pluim
2020-08-31 12:05                   ` Stephen Berman [this message]
2020-09-01 14:28                   ` Lars Ingebrigtsen
2020-09-01 15:03                     ` Robert Pluim
2020-09-01 15:06                       ` Lars Ingebrigtsen
2020-09-01 15:40                         ` Robert Pluim
2020-09-01 16:46                           ` Lars Ingebrigtsen
2020-09-01 17:44                             ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imczf2ar.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=43003@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).