GNU bug report logs - #74626
30.0.91; mini buffer password prompt mismatches shell buffer's

Previous Next

Package: emacs;

Reported by: Van Ly <van.ly <at> SDF.ORG>

Date: Sat, 30 Nov 2024 16:21:02 UTC

Severity: normal

Found in version 30.0.91

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74626 in the body.
You can then email your comments to 74626 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sat, 30 Nov 2024 16:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Van Ly <van.ly <at> SDF.ORG>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 30 Nov 2024 16:21:02 GMT) Full text and rfc822 format available.

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

From: Van Ly <van.ly <at> SDF.ORG>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.91; mini buffer password prompt mismatches shell buffer's
Date: Sat, 30 Nov 2024 16:19:45 +0000
[Message part 1 (text/plain, inline)]
Hello,

When using ssh to connect to a machine, the password prompt is expected
to be identical in the shell buffer and mini buffer.

The mini buffer's prompt seems to make use of only the last character.

See

  http://sdf.org/~van.ly/img/emacs-30-0-91-password-prompt.webp

The shell buffer's password prompt shows

  van <at> 192.168.1.144's password:

The mini buffer shows

  4's password:

Further attempts to backout using C-g and RET may show on the mini buffer

  44's password:

To demonstrate,

 0. start, emacs -Q
 1. use, M-x shell
 2. use, ssh to connect to machine (ssh is unconfigured)

 X. expect the mini buffer password prompt to be more meaningfully
    related to the actual prompt in the shell buffer

[x (application/octet-stream, attachment)]
[Message part 3 (text/plain, inline)]

-- 
vl

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sat, 30 Nov 2024 17:33:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Van Ly via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: Van Ly <van.ly <at> SDF.ORG>, 74626 <at> debbugs.gnu.org
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches
 shell buffer's
Date: Sat, 30 Nov 2024 18:32:47 +0100
Van Ly via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> Hello,
>
> When using ssh to connect to a machine, the password prompt is expected
> to be identical in the shell buffer and mini buffer.
>
> The mini buffer's prompt seems to make use of only the last character.
>
> See
>
>   http://sdf.org/~van.ly/img/emacs-30-0-91-password-prompt.webp
>
> The shell buffer's password prompt shows
>
>   van <at> 192.168.1.144's password:
>
> The mini buffer shows
>
>   4's password:

I can confirm this bug.  I did not report it but I've seen this only
when the host is just an IP address.
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sat, 30 Nov 2024 17:33:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sat, 30 Nov 2024 19:30:02 GMT) Full text and rfc822 format available.

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

From: Van Ly <van.ly <at> SDF.ORG>
To: Manuel Giraud <manuel <at> ledu-giraud.fr>
Cc: bug-gnu-emacs <at> gnu.org, 74626 <at> debbugs.gnu.org
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches
 shell buffer's
Date: Sat, 30 Nov 2024 19:29:49 +0000
>>
>> The mini buffer shows
>>
>>   4's password:

Also, the color scheme for the theme `modus-vivendi-tinted' represents
that "4" with an unreadable foreground/background color combination to
my eyes anyway.  It looked gray on gray IIRC.

-- 
vl




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sat, 30 Nov 2024 19:30:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 15:45:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Van Ly via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: Van Ly <van.ly <at> SDF.ORG>, 74626 <at> debbugs.gnu.org,
 Jim Porter <jporterbugs <at> gmail.com>
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches
 shell buffer's
Date: Sun, 01 Dec 2024 16:44:37 +0100
[Message part 1 (text/plain, inline)]
Van Ly via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> Hello,

Hi,

> When using ssh to connect to a machine, the password prompt is expected
> to be identical in the shell buffer and mini buffer.
>
> The mini buffer's prompt seems to make use of only the last character.
>
> See
>
>   http://sdf.org/~van.ly/img/emacs-30-0-91-password-prompt.webp
>
> The shell buffer's password prompt shows
>
>   van <at> 192.168.1.144's password:
>
> The mini buffer shows
>
>   4's password:

Thanks for the report.

I can reproduce the problem. In fact, there are two issues:

- comint-password-prompt-regexp uses "'s" in order to search for a password
  prompt. That's fine for password prompts like "van <at> 192.168.1.144's
  password:", however, everything before this "'s" is ignored when the
  minibuffer prompt is assembled.

- The string the password prompt is looked for is "van <at> 192.168.1.144's
  password:". In comint-watch-for-password-prompt, the "" is removed,
  but while searching for the password prompt. As a result,
  (match-string 0 string) returns a wrong substring (just one position
  left).

The problem does not happen with Emacs 29. The culprit seems to be
commit 1a55e957ae57, which has changed the implementation of
comint-watch-for-password-prompt. The appended patch fixes this for me
in Emacs 30. Could you, please, check?

Jim, do you have a comment?

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 15:46:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 15:49:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: van.ly <at> SDF.ORG, Manuel Giraud <manuel <at> ledu-giraud.fr>,
 74626 <at> debbugs.gnu.org
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches
 shell buffer's
Date: Sun, 01 Dec 2024 16:48:21 +0100
Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

Hi Manuel,

>> The shell buffer's password prompt shows
>>
>>   van <at> 192.168.1.144's password:
>>
>> The mini buffer shows
>>
>>   4's password:
>
> I can confirm this bug.  I did not report it but I've seen this only
> when the host is just an IP address.

For me, it happens also for using a hostname, like "ssh localhost".

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 15:49:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 16:44:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: van.ly <at> SDF.ORG, "Manuel Giraud via Bug reports for GNU Emacs,
 the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>, 74626 <at> debbugs.gnu.org
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches
 shell buffer's
Date: Sun, 01 Dec 2024 17:42:58 +0100
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Manuel Giraud via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
> Hi Manuel,
>
>>> The shell buffer's password prompt shows
>>>
>>>   van <at> 192.168.1.144's password:
>>>
>>> The mini buffer shows
>>>
>>>   4's password:
>>

>> I can confirm this bug.  I did not report it but I've seen this only
>> when the host is just an IP address.
>
> For me, it happens also for using a hostname, like "ssh localhost".

Hi Michael,

You're right, my bad.  It also shows with hostnames it is just that most
of the time I have authorized_keys in place in such case.
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 16:44:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 16:44:03 GMT) Full text and rfc822 format available.

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

From: Van Ly <van.ly <at> SDF.ORG>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: jporterbugs <at> gmail.com, bug-gnu-emacs <at> gnu.org, 74626 <at> debbugs.gnu.org
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches
 shell buffer's
Date: Sun, 01 Dec 2024 16:43:47 +0000
Michael Albinus <michael.albinus <at> gmx.de> writes:

                                    The appended patch fixes this for me
> in Emacs 30. Could you, please, check?

The patch fixes the mismatch.  Thank you.

-- 
vl

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 16:44:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 17:41:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Van Ly <van.ly <at> SDF.ORG>
Cc: jporterbugs <at> gmail.com, bug-gnu-emacs <at> gnu.org, 74626 <at> debbugs.gnu.org
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches
 shell buffer's
Date: Sun, 01 Dec 2024 18:40:20 +0100
Van Ly <van.ly <at> SDF.ORG> writes:

Hi,

>                                     The appended patch fixes this for me
>> in Emacs 30. Could you, please, check?
>
> The patch fixes the mismatch.  Thank you.

Thanks for the feedback. However, I'd like to hear also from Jim. I'm
not sure whether my change of comint-password-prompt-regexp is proper,
we could lose localized password-word-equivalents in that case.

OTOH, ISTM that the ssh password prompt cannot be localized. And there's
also the openssh-8.6p1 format in that regexp, which doesn't use a
localized prompt either.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 17:43:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 18:10:02 GMT) Full text and rfc822 format available.

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

From: Manuel Giraud <manuel <at> ledu-giraud.fr>
To: Van Ly via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs <at> gnu.org>
Cc: Van Ly <van.ly <at> SDF.ORG>, Michael Albinus <michael.albinus <at> gmx.de>,
 74626 <at> debbugs.gnu.org, jporterbugs <at> gmail.com
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches
 shell buffer's
Date: Sun, 01 Dec 2024 19:09:28 +0100
Van Ly via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
>                                     The appended patch fixes this for me
>> in Emacs 30. Could you, please, check?
>
> The patch fixes the mismatch.  Thank you.

FWIW, also fixes the issue for me.  Thanks.
-- 
Manuel Giraud




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 18:10:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74626; Package emacs. (Sun, 01 Dec 2024 19:56:02 GMT) Full text and rfc822 format available.

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

From: Jim Porter <jporterbugs <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>, 74626 <at> debbugs.gnu.org
Cc: van.ly <at> SDF.ORG
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches shell
 buffer's
Date: Sun, 1 Dec 2024 11:54:05 -0800
On 12/1/2024 7:44 AM, Michael Albinus via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> - comint-password-prompt-regexp uses "'s" in order to search for a password
>    prompt. That's fine for password prompts like "van <at> 192.168.1.144's
>    password:", however, everything before this "'s" is ignored when the
>    minibuffer prompt is assembled.
> 
[snip]
> 
> The problem does not happen with Emacs 29. The culprit seems to be
> commit 1a55e957ae57, which has changed the implementation of
> comint-watch-for-password-prompt. The appended patch fixes this for me
> in Emacs 30. Could you, please, check?
> 
> Jim, do you have a comment?

My goal with the previous change (aside from the 
'comint-password-prompt-max-length' stuff) was just to make sure that we 
don't show extraneous lines in the minibuffer that aren't part of the 
prompt. For example, consider a script like this:

  #!/bin/sh
  cat some-large-file.txt
  echo "Enter password: "
  read PASSWORD
  # ...

The minibuffer would show (some of) the output of "some-large-file.txt".

My hope was to use the matched result from 
'comint-password-prompt-regexp' to do this, though apparently sometimes 
that regexp doesn't match the *whole* password prompt (e.g. in the "'s" 
case you identified). For Emacs 30, maybe the simplest fix is something 
like so? That should restore the old behavior, warts and all:

----------------------------------------

diff --git a/lisp/comint.el b/lisp/comint.el
index 4268fa8dad2..a6b078b685b 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -2574,8 +2574,7 @@ comint-watch-for-password-prompt
     (when (let ((case-fold-search t))
             (string-match comint-password-prompt-regexp
                           (string-replace "\r" "" string)))
-      (setq prompt (string-trim (match-string 0 string)
-                                "[ \n\r\t\v\f\b\a]+" "\n+"))
+      (setq prompt (string-trim string "[ \n\r\t\v\f\b\a]+" "\n+"))
       ;; Use `run-at-time' in order not to pause execution of the
       ;; process filter with a minibuffer
       (run-at-time

----------------------------------------

For the master branch, I think your patch makes sense, assuming we're 
confident that 'comint-password-prompt-regexp' now matches the entire 
prompt in all (most?) cases.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Mon, 02 Dec 2024 18:31:02 GMT) Full text and rfc822 format available.

Notification sent to Van Ly <van.ly <at> SDF.ORG>:
bug acknowledged by developer. (Mon, 02 Dec 2024 18:31:02 GMT) Full text and rfc822 format available.

Message #61 received at 74626-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: van.ly <at> SDF.ORG, 74626-done <at> debbugs.gnu.org
Subject: Re: bug#74626: 30.0.91; mini buffer password prompt mismatches
 shell buffer's
Date: Mon, 02 Dec 2024 19:30:13 +0100
Jim Porter <jporterbugs <at> gmail.com> writes:

Hi Jim,

> For Emacs 30, maybe the simplest fix is something
> like so? That should restore the old behavior, warts and all:
>
> For the master branch, I think your patch makes sense, assuming we're
> confident that 'comint-password-prompt-regexp' now matches the entire
> prompt in all (most?) cases.

Done as proposed. Closing the bug.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 31 Dec 2024 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 171 days ago.

Previous Next


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