GNU bug report logs -
#74626
30.0.91; mini buffer password prompt mismatches shell buffer's
Previous Next
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.
Full log
Message #56 received at 74626 <at> debbugs.gnu.org (full text, mbox):
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.
This bug report was last modified 172 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.