zsh-workers
 help / color / mirror / code / Atom feed
From: Moritz Bunkus <moritz@bunkus.org>
To: zsh-workers@zsh.org
Subject: ssh host completion: ~/.ssh/config vs /etc/hosts
Date: Mon, 10 Aug 2015 12:33:55 +0200	[thread overview]
Message-ID: <20150810103355.GH4077@bunkus.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1187 bytes --]

Hey,

zsh 5.0.8

I just noticed this interesting thing: if certain hosts are listed in
/etc/hosts then the ssh completion will complete _but not list_ hosts in
~/.ssh/config that have the same prefix.

For example, let's take the following entries from /etc/hosts:

172.16.1.2 testme-backup
172.16.1.3 testme-vcenter

Let's assume further that I also have the following in my ~/.ssh/config:

Host testme-nagios
  HostName 172.16.1.4

Host other-master
  HostName 172.16.2.1

Host other-backup
  HostName 162.16.2.2

Now typing »ssh testme-<TAB>« will list testme-backup and
testme-vcenter but not testme-nagios. Typing »ssh testme-n<TAB>«,
however, will compelte to »ssh testme-nagios«.

On the other hand typing »ssh other-<TAB>« will list both entries from
~/.ssh/config, other-master and other-backup. There are no entries in
/etc/hosts that start with other-.

Here's how to reproduce it:

1. Create the appropriate entries in /etc/hosts and ~/.ssh/config.

2. Start a shell and initialize the completion system:

zsh -f
autoload -Uz compinit
compinit

3. Try to complete »ssh testme-« and observe the bug.

Kind regards,
mosu

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

             reply	other threads:[~2015-08-10 10:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 10:33 Moritz Bunkus [this message]
2015-08-10 19:50 ` Bart Schaefer
2015-08-11 12:45   ` Moritz Bunkus
2015-08-11 16:19     ` Bart Schaefer
2015-08-15  0:34   ` Vincent Lefevre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150810103355.GH4077@bunkus.org \
    --to=moritz@bunkus.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).