From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4562 invoked by alias); 5 Nov 2016 20:36:41 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22089 Received: (qmail 29756 invoked from network); 5 Nov 2016 20:36:40 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f177.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.217.177):SA:0(0.0/5.0):. Processed in 0.178283 secs); 05 Nov 2016 20:36:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.177 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=pxmp7Q4J9ZOeAUGeqv2PX5YFP3mYacqqM4ie5NdRmno=; b=AIsii7LglrnbSb0hEe/BL+qNp/D4SPAPKzql0A/y7JdxiPZWIs49cZW12iRp/T5wA3 yKdnqGsWR6r8Wh7r8JT8wSKn3KIOm2qoKq1keNw0G4NPHs1W8gEL7yuAGYWfkWEpjGyx lk+VR43pULHZKprvTaorO7UslemWhGgpvUnTecd70UGKjVKsy0CnZquvycy6ZDfqILdt 8O+Rc1NoB430wG73OmjZsjF5nQNq+RtQhab7C3DmOV+ZQG0uBsjPx8gckTy3Ml3GQ90e dweeGxWPLxvhViTmjvWzTxAKd2WHYFZGN3L2UZJeWVYKGGQ4XSupKAgUNiOENYJkCFAq U9Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=pxmp7Q4J9ZOeAUGeqv2PX5YFP3mYacqqM4ie5NdRmno=; b=ZBynC9JnwL4ISs0txSp8t0zbNbydaySVnh7/J3z9FecS97Xwdf5QJ09PzC4lUj/Kzh RKyPgUF3uud5hat/4KSNcevV8I9VlLXR6g+GxiGBPr6Whk90RGA+atR2ZIaT4AttqYLq TM7yY6+RAqPNRX37SCy3aalMAYpiM56nzFQwYwQ9AsQu6wrN7gWQava8ijXUAlKJIvxI qj2BL7t1+TS0CTFkCIgPZK5rgSINnBkKJGdtO5AL844pGe6nRFeGJ1S7ChVvyMRNAPO0 UgXPXEjUYLjXbXEnVbCT45FOQgPByrGeKasvPZ8PSMig7rrqZ6wqQxAHPXqQpSkoWud4 1+gQ== X-Gm-Message-State: ABUngvcdpemWYEHbOloy3Esu+/led8bdQXBFs88Is7GzKe5oTkoOvSO2tShYDSHs4B0szg== X-Received: by 10.176.82.181 with SMTP id v50mr13522868uav.31.1478377761658; Sat, 05 Nov 2016 13:29:21 -0700 (PDT) From: Bart Schaefer Message-Id: <161105132953.ZM17234@torch.brasslantern.com> Date: Sat, 5 Nov 2016 13:29:53 -0700 In-Reply-To: <581E2AE5.4040006@gmx.ch> Comments: In reply to Fourhundred Thecat <400thecat@gmx.ch> "Re: hostname completion for ssh / scp" (Nov 5, 7:54pm) References: <581B8BCE.2040108@gmx.ch> <161104214237.ZM18518@torch.brasslantern.com> <581D9E98.1000008@gmx.ch> <161105102455.ZM20692@torch.brasslantern.com> <581E2AE5.4040006@gmx.ch> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: hostname completion for ssh / scp MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Nov 5, 7:54pm, Fourhundred Thecat wrote: } Subject: Re: hostname completion for ssh / scp } } > On 2016-11-05 18:24, Bart Schaefer wrote: } > Well, yes. The syntax of the /etc/hosts file is first an IP and then } > a hostname. Somebody will possibly correct me, but I don't recall } > any valid use of /etc/hosts that has lines of host names without IPs. } } Not true. IP address is not mandatory in /etc/hosts. /etc/hosts is a file read by the DNS resolver library to look up IPs for hosts that either aren't found in DNS, or that locally need to use a different IP than the one found by a network DNS lookup. It is not there for purposes of configuring completions in the shell, and lines that don't have an IP address are useless for the intended purpose of the file. Read "man 5 hosts". Bash might let you use it the way you say by way of a non-strict parse of the contents, but that doesn't make it right. } > However, ~/.ssh/config will be skipped if the users-hosts tag finds } > any matching hosts } } yes that is correct. } But this is a terrible feature. The completion jumps to first matching } hostname, completely ignoring other matching hostnames. This goes way back to 2007, users/11333 and the thread leading up to it. The intention is that if the user has the users-hosts style configured for the my-accounts tag and gets a match from it, then ~/.ssh/config should not be consulted. However, because _combination is used by _ssh_hosts to also call the completion for hosts, the users-hosts lookup can succeed even if the users-hosts style is unset. I don't think that was an expected effect. However, I don't know the best way to address it. I expected to be able to work around this by: zstyle -e ':completion:*:(ssh|scp):*:my-accounts' users-hosts 'return 1' and indeed that bypasses the call to _hosts, but the return value from _combination is not 1, so ~/.ssh/config is still not examined. So that's another bug to file.