From: Jari Aalto <jari.aalto@cante.net>
To: Emacs bug BTS <submit@emacsbugs.donarmstrong.com>
Subject: bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen
Date: Sun, 29 Mar 2009 19:20:31 +0300 [thread overview]
Message-ID: <874oxcnvw0.fsf@jondo.cante.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 458 bytes --]
Added support for ssh-keygen(1) prompt and changed to new format because
the old one was hard to decipher and keep track on.
The enw one is easier to maintaintain. The tester 'dolist' can be used
to verify new prompts as the variable is changed.
Jari
2009-03-29 Jari Aalto <jari.aalto@cante.net>
* comint.el (comint-password-prompt-regexp): Rewrite using
regexp-opt. Add ssh-keygen check. Add dolist block to test new
regexp.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-comint.el-comint.el-comint-password-prompt-re.patch --]
[-- Type: text/x-diff, Size: 3255 bytes --]
From 804b37d9bdcffc4980af4f075ee804ea6a8471d2 Mon Sep 17 00:00:00 2001
From: Jari Aalto <jari.aalto@cante.net>
Date: Sun, 29 Mar 2009 19:13:06 +0300
Subject: [PATCH] lisp/comint.el: comint.el (comint-password-prompt-regexp): Rewrite using regexp-opt
---
lisp/comint.el | 71 +++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 58 insertions(+), 13 deletions(-)
diff --git a/lisp/comint.el b/lisp/comint.el
index 5bff986..155dfde 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -328,25 +328,70 @@ This variable is buffer-local."
:type 'boolean
:group 'comint)
-;; AIX puts the name of the person being su'd to in front of the prompt.
-;; kinit prints a prompt like `Password for devnull@GNU.ORG: '.
-;; ksu prints a prompt like `Kerberos password for devnull/root@GNU.ORG: '.
-;; ssh-add prints a prompt like `Enter passphrase: '.
-;; plink prints a prompt like `Passphrase for key "root@GNU.ORG": '.
-;; Ubuntu's sudo prompts like `[sudo] password for user:'
-;; Some implementations of passwd use "Password (again)" as the 2nd prompt.
-;; Something called "perforce" uses "Enter password:".
(defcustom comint-password-prompt-regexp
- "\\(\\(Enter \\|[Oo]ld \\|[Nn]ew \\|'s \\|login \\|\
-Kerberos \\|CVS \\|UNIX \\| SMB \\|LDAP \\|\\[sudo] \\|^\\)\
-\[Pp]assword\\( (again)\\)?\\|\
-pass phrase\\|\\(Enter \\|Repeat \\|Bad \\)?[Pp]assphrase\\)\
-\\(?:, try again\\)?\\(?: for [^:]+\\)?:\\s *\\'"
+ (concat
+ "^\\("
+ (regexp-opt
+ '(;; AIX puts the name of the person being su'd to in front of the prompt.
+ "'s"
+ "Bad"
+ "CVS"
+ "Enter same"
+ "Enter"
+ "Kerberos"
+ "LDAP"
+ "Login"
+ "New"
+ "Old"
+ "Repeat"
+ "SMB"
+ "UNIX"
+ "[sudo]"
+ "bad"
+ "login"
+ "new"
+ "old"
+ "repeat"))
+ " +\\)?"
+ (regexp-opt
+ '("password"
+ "Password"
+ "passphrase"
+ "pass phrase"
+ "Passphrase"
+ "Pass phrase"))
+ "\\("
+ "\\(?:, try \\)?\\( *again\\)?\\(?: for [^:]+\\)?:\\|"
+ " (empty for no passphrase):\\|"
+ " (again)\\|"
+ " for key"
+ "\\)"
+ )
"Regexp matching prompts for passwords in the inferior process.
This is used by `comint-watch-for-password-prompt'."
:type 'regexp
:group 'comint)
+(when nil
+
+ ;; Tester. Run C-x C-e at the end to test new prompts or after
+ ;; changes to comint-password-prompt-regexp
+
+ (dolist (str '("Password for devnull@GNU.ORG: " ; knit
+ "Kerberos password for devnull/root@GNU.ORG: " ; ksu
+ "Enter passphrase: " ; ssh-add
+ "Enter passphrase (empty for no passphrase): " ; ssh-keygen
+ "Enter same passphrase again: " ; ssh-keygen
+ "Passphrase for key root@GNU.ORG: " ; plink
+ "[sudo] password for user:" ; Ubuntu sudo
+ ;; some implementation of passwd(1) as the 2nd prompt
+ "Password (again)"
+ "Enter password:")) ; perforce
+ (unless (string-match comint-password-prompt-regexp str)
+ (error "Did not match: %s" str)))
+
+ )
+
;; Here are the per-interpreter hooks.
(defvar comint-get-old-input (function comint-get-old-input-default)
"Function that returns old text in Comint mode.
--
1.6.1.3
next reply other threads:[~2009-03-29 16:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-29 16:20 Jari Aalto [this message]
2010-04-10 23:55 ` bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen Chong Yidong
2010-06-09 21:52 ` Glenn Morris
2010-06-11 14:40 ` Chong Yidong
-- strict thread matches above, loose matches on Subject: below --
2009-03-29 17:25 Chong Yidong
2009-03-29 20:43 ` Jari Aalto
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874oxcnvw0.fsf@jondo.cante.net \
--to=jari.aalto@cante.net \
--cc=2817@emacsbugs.donarmstrong.com \
--cc=submit@emacsbugs.donarmstrong.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.