From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11176 invoked from network); 24 Jun 2007 19:44:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 24 Jun 2007 19:44:22 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 33350 invoked from network); 24 Jun 2007 19:44:16 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 24 Jun 2007 19:44:16 -0000 Received: (qmail 27239 invoked by alias); 24 Jun 2007 19:44:13 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23596 Received: (qmail 27228 invoked from network); 24 Jun 2007 19:44:12 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 24 Jun 2007 19:44:12 -0000 Received: (qmail 33054 invoked from network); 24 Jun 2007 19:44:12 -0000 Received: from redoubt.spodhuis.org (HELO mx.spodhuis.org) (193.202.115.177) by a.mx.sunsite.dk with SMTP; 24 Jun 2007 19:44:08 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=first1; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=jjP2B1I89UOn4ErJnRoKS9HBa88L29YfN3m1TWOshwtsV632Me/+q3OFCyzOf3Q5Bi0neO9ksqaPM59lUu46ARa4fWWF6GGtgxkXYKYVPvlS+egPYtZBRR6X7dT/H0aAPaFcQpPM8Ei4BU0VobwSCqt3qzCQyhBzPYfza8HBBuI=; Received: by smtp.spodhuis.org with local id 1I2Y0E-000JCr-MQ; Sun, 24 Jun 2007 19:44:06 +0000 Date: Sun, 24 Jun 2007 12:44:06 -0700 From: Phil Pennock To: zsh-workers@sunsite.dk Cc: Pierre Habouzit Subject: Re: Bug#430146: zsh: please add .ssh/config Hosts to the hosts zstyle completion Message-ID: <20070624194406.GA73513@redoubt.spodhuis.org> Mail-Followup-To: zsh-workers@sunsite.dk, Pierre Habouzit References: <20070622180648.14337.68045.reportbug@localhost> <20070622211507.GA16349@scowler.net> <20070622222216.GA9656@artemis.internal.dc7.debconf.org> <20070623074721.GA28769@scowler.net> <20070623113320.GA25562@artemis.internal.dc7.debconf.org> <20070624115727.GA31510@scowler.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070624115727.GA31510@scowler.net> On 2007-06-24 at 07:57 -0400, Clint Adams wrote: > On Sat, Jun 23, 2007 at 12:33:21PM +0100, Pierre Habouzit wrote: > > Anyways, I'm not using it anymore because I fancy the > > .ssh/known_hosts more, but I miss it :) > > We could do something like this to generate matches from ~/.ssh/config . > Anyone have better ideas? The Hosts lines in .ssh/config are glob patterns. Both '*' and '?' are valid characters. With farms of machines under a consistent naming scheme, this comes into play. Further, multiple patterns can be on the same line, so you can have hostnames and patterns. I look at my config now ... ugh. Way to make things bad: have a section of your ~/.ssh/config delimited by magic comments used by another script when generating an updated config file. > + if zstyle -t ":completion:${curcontext}:hosts" use-ssh-config; then > + [[ -r ~/.ssh/config ]] && _cache_hosts+=(${=${${(M)${(f)"$(<~/.ssh/config)"}:#Host*}#Host }:#*\**}) > + fi I think that: ${=${${(M)${(f)"$(<~/.ssh/config)"}:#Host*}#Host }:#*\**} should be: ${${=${(M)${(f)"$(<~/.ssh/config)"}:#Host*}#Host }:#*[\*\?]*} This splits on $IFS earlier so that the outer :# filter applies on a per-item basis instead of per-line, and adds '?' to the filter pattern. And people wonder why I laugh when they describe _Perl_ as a line-noise language. ;-) Regards, -Phil