unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#10533: 24.0.92; pcmpl-ssh-known-hosts - parse hosts with non-standard port numbers
@ 2012-01-17 13:16 Mike Lamb
  2012-01-27 21:14 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Lamb @ 2012-01-17 13:16 UTC (permalink / raw)
  To: 10533

This patch extends the regex in pcmpl-ssh-known-hosts to include hosts
that use a non-standard port number.

The description of this syntax in the sshd(8) man page is:
A hostname or address may optionally be enclosed within `[' and `]'
brackets then followed by `:' and a non-standard port number.

Patch:

*** emacs-24.0.92.4/lisp/pcmpl-unix.el	2012-01-16 17:36:24.000000000 -0500
--- emacs-patch/lisp/pcmpl-unix.el	2012-01-16 17:36:42.000000000 -0500
***************
*** 152,164 ****
               (file-readable-p pcmpl-ssh-known-hosts-file))
      (with-temp-buffer
        (insert-file-contents-literally pcmpl-ssh-known-hosts-file)
!       (let (ssh-hosts-list)
!         (while (re-search-forward "^ *\\([-.[:alnum:]]+\\)[, ]" nil t)
!           (add-to-list 'ssh-hosts-list (match-string 1))
            (while (and (looking-back ",")
!                       (re-search-forward "\\([-.[:alnum:]]+\\)[, ]"
                                           (line-end-position) t))
!             (add-to-list 'ssh-hosts-list (match-string 1))))
          ssh-hosts-list))))
  
  (defun pcmpl-ssh-config-hosts ()
--- 152,166 ----
               (file-readable-p pcmpl-ssh-known-hosts-file))
      (with-temp-buffer
        (insert-file-contents-literally pcmpl-ssh-known-hosts-file)
!       (let (ssh-hosts-list
! 	    (host-re "\\(?:\\([-.[:alnum:]]+\\)\\|\\[\\([-.[:alnum:]]+\\)\\]:[0-9]+\\)[, ]")
! )
!         (while (re-search-forward (concat "^ *" host-re) nil t)
!           (add-to-list 'ssh-hosts-list (concat (match-string 1) (match-string 2)))
            (while (and (looking-back ",")
!                       (re-search-forward host-re
                                           (line-end-position) t))
!             (add-to-list 'ssh-hosts-list (concat (match-string 1) (match-string 2)) )))
          ssh-hosts-list))))
  
  (defun pcmpl-ssh-config-hosts ()


Test data for ~/.ssh/known_hosts:

host1 ssh-rsa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
host2,host3 ssh-rsa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
[host4]:2222 ssh-rsa cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
[host5]:2222,[host6]:2222 ssh-rsa dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
10.0.0.1 ssh-rsa eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
10.0.0.2,10.0.0.3 ssh-rsa ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
[10.0.0.4]:2222 ssh-rsa gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
[10.0.0.5]:2222,[10.0.0.6]:2222 ssh-rsa ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

From emacs -Q:
M-x eshell
ssh TAB

Without patch:
Possible completions are:
10.0.0.3                               10.0.0.2                               10.0.0.1
host3                                  host2                                  host1

With patch:
Possible completions are:
10.0.0.6 	10.0.0.5 	10.0.0.4 	10.0.0.3 	10.0.0.2 	10.0.0.1
host6 	host5 	host4 	host3 	host2 	host1


In GNU Emacs 24.0.92.4 (x86_64-apple-darwin11.2.0)
 of 2012-01-16 on anvil.home
configured using `configure  '--without-x' '--without-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: EShell

Minor modes in effect:
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 0 ; 9 5 ; c ESC x e s h e l l RET s s h SPC 
TAB DEL SPC TAB DEL DEL DEL DEL DEL ESC x b u g TAB 
TAB DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL 
DEL DEL r e p o r t - b TAB RET

Recent messages:
Loading em-glob...done
Loading em-hist...done
Loading em-ls...done
Loading em-prompt...done
Loading em-script...done
Loading em-term...done
Loading em-unix...done
Hit space to flush [2 times]
delete-backward-char: Text is read-only
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
emacsbug help-mode easymenu view pcmpl-unix ansi-color em-unix pcomplete
comint regexp-opt em-term term disp-table ehelp electric em-script
em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic esh-opt
em-banner em-alias ring esh-var esh-io esh-cmd esh-ext esh-proc esh-arg
eldoc help-fns esh-groups eshell esh-module esh-mode esh-util time-date
ediff-hook vc-hooks lisp-float-type lisp-mode register page menu-bar
rfn-eshadow timer jit-lock font-lock syntax facemenu font-core frame
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer loaddefs button faces cus-face files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
multi-tty emacs)





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

* bug#10533: 24.0.92; pcmpl-ssh-known-hosts - parse hosts with non-standard port numbers
  2012-01-17 13:16 bug#10533: 24.0.92; pcmpl-ssh-known-hosts - parse hosts with non-standard port numbers Mike Lamb
@ 2012-01-27 21:14 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2012-01-27 21:14 UTC (permalink / raw)
  To: 10533-done

Version: 24.0.93

Thank you; applied.





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

end of thread, other threads:[~2012-01-27 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-17 13:16 bug#10533: 24.0.92; pcmpl-ssh-known-hosts - parse hosts with non-standard port numbers Mike Lamb
2012-01-27 21:14 ` Glenn Morris

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