GNU bug report logs - #13124
add non-English regexps to comint-password-prompt-regexp for sudo password prompt

Previous Next

Package: emacs;

Reported by: arne_bab <at> web.de

Date: Sat, 8 Dec 2012 13:29:01 UTC

Severity: normal

Found in version 24.1

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

Bug is archived. No further changes may be made.

Full log


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

From: Kenichi Handa <handa <at> gnu.org>
To: Arne Babenhauserheide <arne_bab <at> web.de>
Cc: 13124 <at> debbugs.gnu.org, rgm <at> gnu.org
Subject: Re: bug#13124: 24.1; shell-mode does not hide sudo password prompts
Date: Thu, 13 Dec 2012 23:14:19 +0900
In article <2937464.OIdV3OoAVt <at> fluss>, Arne Babenhauserheide <arne_bab <at> web.de> writes:

> I installed emacs for a collegue and the visible password is the major reason 
> why he switches to the quite inconvenient term/ansi-term mode instead of 
> shell.

> So I think it is very relevant: It’s a matter of good defaults to never show 
> the Password your user types. Especially not (quasi-)root passwords.

It seems to be difficult to setup
comint-password-prompt-regexp for all variations of prompts
for password.  How about using this kind of code (incomplete)?

(defun shell-enter-password ()
  (interactive)
  (let* ((inhibit-field-text-motion t)
	 (prompt (buffer-substring (line-beginning-position) (point))))
    (if (and (not (string-match comint-password-prompt-regexp prompt))
	     (y-or-n-p (format "Remember \"%s\" as a password prompt for the future session? " prompt)))
	;; Insert a proper code to add PROMPT to comint-password-prompt-regexp
	;; and save it in .emacs.
	nil)
    (send-invisible prompt)))

(define-key shell-mode-map "\C-cp" 'shell-enter-password)

One can type C-c p when the shell buffer displays a prompt
for password without letting user enter a password in the
minibuffer.

---
Kenichi Handa
handa <at> gnu.org




This bug report was last modified 11 years and 130 days ago.

Previous Next


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