unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen
@ 2009-03-29 16:20 Jari Aalto
  2010-04-10 23:55 ` Chong Yidong
  0 siblings, 1 reply; 6+ messages in thread
From: Jari Aalto @ 2009-03-29 16:20 UTC (permalink / raw)
  To: Emacs bug BTS

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen
@ 2009-03-29 17:25 Chong Yidong
  2009-03-29 20:43 ` Jari Aalto
  0 siblings, 1 reply; 6+ messages in thread
From: Chong Yidong @ 2009-03-29 17:25 UTC (permalink / raw)
  To: Jari Aalto; +Cc: 2817

> Added support for ssh-keygen(1) prompt and changed to new format
> because the old one was hard to decipher and keep track on.

I'd prefer a less invasive change at this stage of the release.  Could
you submit a patch that uses the old code instead of rewriting it?
Thanks.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen
  2009-03-29 17:25 Chong Yidong
@ 2009-03-29 20:43 ` Jari Aalto
  0 siblings, 0 replies; 6+ messages in thread
From: Jari Aalto @ 2009-03-29 20:43 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 2817

Chong Yidong <cyd@stupidchicken.com> writes:

>> Added support for ssh-keygen(1) prompt and changed to new format
>> because the old one was hard to decipher and keep track on.
>
> I'd prefer a less invasive change at this stage of the release.  Could
> you submit a patch that uses the old code instead of rewriting it?
> Thanks.

I couldn't read the old code.

The tester 'dolist' verifies that it matches the old settings.

Jari






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen
  2009-03-29 16:20 bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen Jari Aalto
@ 2010-04-10 23:55 ` Chong Yidong
  2010-06-09 21:52   ` Glenn Morris
  0 siblings, 1 reply; 6+ messages in thread
From: Chong Yidong @ 2010-04-10 23:55 UTC (permalink / raw)
  To: Jari Aalto; +Cc: 2817

> Added support for ssh-keygen(1) prompt and changed to new format because
> the old one was hard to decipher and keep track on.

Thanks, I have commited the change to the trunk.






^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen
  2010-04-10 23:55 ` Chong Yidong
@ 2010-06-09 21:52   ` Glenn Morris
  2010-06-11 14:40     ` Chong Yidong
  0 siblings, 1 reply; 6+ messages in thread
From: Glenn Morris @ 2010-06-09 21:52 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 2817, Jari Aalto

Chong Yidong wrote:

>> Added support for ssh-keygen(1) prompt and changed to new format because
>> the old one was hard to decipher and keep track on.
>
> Thanks, I have commited the change to the trunk.

This can't be right. Eg why is there now a "^" at the start of the
regexp, when there was not before?

See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6367





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen
  2010-06-09 21:52   ` Glenn Morris
@ 2010-06-11 14:40     ` Chong Yidong
  0 siblings, 0 replies; 6+ messages in thread
From: Chong Yidong @ 2010-06-11 14:40 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 2817, Jari Aalto

Glenn Morris <rgm@gnu.org> writes:

> Chong Yidong wrote:
>
>>> Added support for ssh-keygen(1) prompt and changed to new format because
>>> the old one was hard to decipher and keep track on.
>>
>> Thanks, I have commited the change to the trunk.
>
> This can't be right. Eg why is there now a "^" at the start of the
> regexp, when there was not before?
>
> See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6367

The ^ is wrong, thanks for pointing this out.  I've removed it, and
added a test for this in test/comint-testsuite.el.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-06-11 14:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-29 16:20 bug#2817: [PATCH] Emacs CVS: comint-password-prompt-regexp - support ssh-keygen Jari Aalto
2010-04-10 23:55 ` 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

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