From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Jan Palus <jpalus@fastmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: zsh does not offer ssh host from config
Date: Sat, 10 Dec 2022 12:01:24 +0000 [thread overview]
Message-ID: <20221210120124.GY27622@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20221209010650.sq2cp5a2op2mrpat@pine.grzadka>
Jan Palus wrote on Fri, Dec 09, 2022 at 02:06:50 +0100:
> Hi,
>
> I've got a single real hostname starting with 'build' prefix which is present
> in my known_hosts file. I also have a couple Host specifications in ssh config
> file having names starting with 'build' but real HostName does not resolve to
> name starting with 'build'. When doing `ssh build<tab>` I'd expect to be
> offered both real hostname as well as Host specification names, however only
> real hostname is immediately completed. That's because of _ssh_hosts returning
> on successful hosts completion:
>
> # If users-hosts matches, we shouldn't complete anything else.
> if [[ "$IPREFIX" == *@ ]]; then
> _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@" && return
> else
> _combination -s '[:@]' my-accounts users-hosts \
> ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@" && return # <--- HERE
> fi
>
> Is this intentional that config file parsing is skipped entirely if host was
> completed successfully?
That «return» was added in https://www.zsh.org/users/11333 with the
intention of skipping config file parsing if a match was found /in the
users-hosts style/. However, in a quick test with these fictional
values:
[[[
% zstyle -L \* users-hosts; echo $?
1
% tail -2 ~/.ssh/config
Host completion-test1.zsh.org
HostName 2001:db8::zsh
% tail -1 ~/.ssh/known_hosts
completion-test2.zsh.org,2001:db8::zsh x-not-a-real-identifier abcdef01
%
]]]
I observe that «ssh completion<TAB>» only offers completion-test2.zsh.org,
not completion-test1.zsh.org. I take it both should be offered (since
users-hosts is unset).
next prev parent reply other threads:[~2022-12-10 12:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 1:06 Jan Palus
2022-12-10 12:01 ` Daniel Shahaf [this message]
2022-12-10 12:08 ` Roman Perepelitsa
2022-12-10 20:06 ` Jan Palus
2022-12-10 20:31 ` Roman Perepelitsa
2022-12-10 20:49 ` Bart Schaefer
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=20221210120124.GY27622@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=jpalus@fastmail.com \
--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).