From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26698 invoked by alias); 20 Dec 2013 20:04:32 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32163 Received: (qmail 21384 invoked from network); 20 Dec 2013 20:04:26 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=rbgj2TgcYkEuNe+BVY0CLE7XWeYAJLix3f8OVnqeNLw=; b=JUN5KlRh/Uz4I5PXcw8nEpfbv3bp9RhA1LyyqPQwItBKxkXR9E68UxS1WdJxQJ90E7 xVyvcnxURbIMk6XHGViT9LNL1L7N+JKX3DFSSlzxgEVDhTwAzre4rG5xGJRjiQMbXieI 2WTlVtno1skjJCxS3gDQ09XKgoA5iko27Mwv9AHUxNknmyAry4JB1AWjTI0MGWX+659v PLcC71DKqOJLVzh8OXHz7Y/i8ELU6H1R+Ui5OwNBxWR+mh984WVu/2OOIXbhzwndZ1Lm b2UrpNYZyagcCBTpgd1nNofgo+RQbovhrhEMjES9YvkhF4knku/n8+euAfbmabDugp4g aZfQ== MIME-Version: 1.0 X-Received: by 10.58.168.205 with SMTP id zy13mr2520666veb.19.1387569863624; Fri, 20 Dec 2013 12:04:23 -0800 (PST) In-Reply-To: References: Date: Fri, 20 Dec 2013 12:04:23 -0800 Message-ID: Subject: Re: [PATCH] Parse Additional SSH known_hosts Syntax From: Aaron Peschel To: zsh-workers@zsh.org Content-Type: text/plain; charset=ISO-8859-1 Hello, I am new to this project, what is the proper etiquette for getting some attention on this list? -Aaron On Thu, Dec 12, 2013 at 3:55 PM, Aaron Peschel wrote: > Hello, > > The patch got corrupted in the email. I have attached the patch here instead. > > --Aaron > > On Thu, Dec 12, 2013 at 3:52 PM, Aaron Peschel wrote: >> Hello, >> >> I have created a patch for ZSH to support additional known_hosts >> syntax. Feedback would be appreciated. >> >> Thank you! >> >> Aaron Peschel >> >> ----- >> >> From 3d05d6f46ac89f1d91f6e7ab4981c2dc410c956a Mon Sep 17 00:00:00 2001 >> From: Aaron Peschel >> Date: Thu, 12 Dec 2013 15:43:55 -0800 >> Subject: [PATCH 1/1] Parse Additional SSH known_hosts Syntax >> >> ZSH does not currently support the full known_hosts syntax. The >> known_hosts file supports lines starting with "[hostname]:post". ZSH >> currently discards these lines, which breaks SSH auto-completion on >> hosts using a non-standard SSH port. This patch adds support for this >> syntax and allows auto-completion to work in this case. >> --- >> Completion/Unix/Type/_hosts | 15 +++++++++++++-- >> 1 file changed, 13 insertions(+), 2 deletions(-) >> >> diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts >> index 499caed..c3133dc 100644 >> --- a/Completion/Unix/Type/_hosts >> +++ b/Completion/Unix/Type/_hosts >> @@ -41,9 +41,20 @@ if ! zstyle -a ":completion:${curcontext}:hosts" >> hosts _hosts; then >> >> for khostfile in $khostfiles; do >> if [[ -r $khostfile ]]; then >> - khosts=(${${(s:,:)${(j:,:)${(u)${(f)"$(<$khostfile)"}%%[ >> |#]*}}}:#*[\[\]]*}) >> + khosts=(${(s/,/j/,/u)${(f)"$(<$khostfile)"}%%[ |#]*}) >> + >> + # known_hosts syntax supports the host being in the form >> [hostname]:port >> + # The filter below extracts the hostname from lines using this format. >> + khosts=($(for host ($khosts); do >> + if [[ $host =~ "\[(.*)\]:\d*" ]]; then >> + echo $match >> + else >> + echo $host >> + fi >> + done)) >> + >> if [[ -z $useip ]]; then >> - khosts=(${${${khosts:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)}:#*[\[\]]*}) >> + khosts=(${${khosts:#(#s)[0-9]##.[0-9]##.[0-9]##.[0-9]##(#e)}:#(#s)[0-9a-f:]##(#e)}) >> fi >> _cache_hosts+=($khosts) >> fi >> -- >> 1.8.3.4 (Apple Git-47)