From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Lamb Newsgroups: gmane.emacs.bugs Subject: bug#10533: 24.0.92; pcmpl-ssh-known-hosts - parse hosts with non-standard port numbers Date: Tue, 17 Jan 2012 08:16:30 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1326820040 12081 80.91.229.12 (17 Jan 2012 17:07:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 17 Jan 2012 17:07:20 +0000 (UTC) To: 10533@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 17 18:07:16 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RnCV6-0006i6-BL for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Jan 2012 18:07:12 +0100 Original-Received: from localhost ([::1]:56114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnCV5-00056x-F2 for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Jan 2012 12:07:11 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:54778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnCUy-00056o-4h for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 12:07:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RnCUw-0000J0-0E for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 12:07:04 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RnCUv-0000Iw-TQ for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 12:07:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RnCVu-0006ll-Eb for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 12:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mike Lamb Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Jan 2012 17:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10533 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.132682002625935 (code B ref -1); Tue, 17 Jan 2012 17:08:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Jan 2012 17:07:06 +0000 Original-Received: from localhost ([127.0.0.1]:33767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RnCUy-0006kF-GR for submit@debbugs.gnu.org; Tue, 17 Jan 2012 12:07:05 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:45189) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rn8v4-0000Xw-I6 for submit@debbugs.gnu.org; Tue, 17 Jan 2012 08:17:48 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rn8tz-0007SK-Sx for submit@debbugs.gnu.org; Tue, 17 Jan 2012 08:16:46 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:53960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rn8tz-0007SG-RC for submit@debbugs.gnu.org; Tue, 17 Jan 2012 08:16:39 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:48796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rn8tv-00027v-Ie for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 08:16:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rn8tt-0007Rm-Jk for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 08:16:35 -0500 Original-Received: from mail-vx0-f169.google.com ([209.85.220.169]:59829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rn8tt-0007Q7-DH for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2012 08:16:33 -0500 Original-Received: by mail-vx0-f169.google.com with SMTP id fl11so189437vcb.0 for ; Tue, 17 Jan 2012 05:16:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type; bh=dr7Nb6/qpqQQEHMIG52/Yp0faxKQrXVkyQJsxupppeg=; b=vAurOpH6bRmTOAS5WsYEhpwwloDrg3dXr1weTXLyZADl3V/eQvFRjcEKjjcw/SKb4K oMDrU8/uuLIlUJ0GwcFKb97r+eIRTWL0lHlZNzZyA0CHWrXdwtn+8EMiZ+dhMeoTb+VD JctHc5FQnRgkG3g2w3SY3gKHoIKDUirlfQyr8= Original-Received: by 10.220.140.135 with SMTP id i7mr9854844vcu.65.1326806193264; Tue, 17 Jan 2012 05:16:33 -0800 (PST) Original-Received: from anvil.home (pool-71-187-68-105.nwrknj.fios.verizon.net. [71.187.68.105]) by mx.google.com with ESMTPS id hj10sm18289199vdb.0.2012.01.17.05.16.31 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 17 Jan 2012 05:16:32 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Tue, 17 Jan 2012 12:07:02 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:55819 Archived-At: 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)