Zsh Mailing List Archive
Messages sorted by:
Re: hostname completion for ssh / scp
- X-seq: zsh-users 22089
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: hostname completion for ssh / scp
- Date: Sat, 5 Nov 2016 13:29:53 -0700
- 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==
- In-reply-to: <581E2AE5.firstname.lastname@example.org>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <581B8BCE.email@example.com> <161104214237.ZM18518@torch.brasslantern.com> <581D9E98.firstname.lastname@example.org> <161105102455.ZM20692@torch.brasslantern.com> <581E2AE5.email@example.com>
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.
Messages sorted by: