Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in SSH-Autocomplete with non-standard ports #1355

Closed
Luzifer opened this issue Mar 23, 2014 · 6 comments
Closed

Bug in SSH-Autocomplete with non-standard ports #1355

Luzifer opened this issue Mar 23, 2014 · 6 comments
Milestone

Comments

@Luzifer
Copy link
Contributor

Luzifer commented Mar 23, 2014

As a fish-shell user I want to use command autocompletion for the ssh-command even when I'm working a lot with server listening on non-standard ports.

Expected behavior:

  • Typing ssh myser<tab>
  • Getting ssh myserver.hoster.domain.tld
  • OR getting ssh -p2022 myserver.hoster.domain.tld

Actual behavior:

  • Typing ssh myser<tab>
  • Getting ssh \[myserver.hoster.domain.tld\]:2022

Either the port should get added as -p 2022 or it should completely be ignored as most people working with a lot of those special cases already have specific rulesets in their ~/.ssh/config to handle those non-standard ports.

Reason

Standard-port-servers are added like this in ~/.ssh/known_hosts:

github.com,204.232.175.90 ssh-rsa [...]

Non-standard-port-servers are added like this:

[myserver.hoster.domain.tld]:2022,[10.0.0.1]:2022 ssh-rsa [...]

System

OSX 10.9.2

luzifer@knut-workstation01 ~> fish --version
fish, version 2.1.0
@ridiculousfish
Copy link
Member

Probably share/functions/__fish_print_hostnames.fish should be taught about this second ssh style. Today it's:

sgrep -Eoh '^[^#@|, ]*' ~/.ssh/known_hosts{,2} ^/dev/null

@KamilaBorowska
Copy link
Contributor

+1. I wanted to report this a long time ago (my server runs on port 98), but I guess I forgot. Also, consider it to be confirmed since introduction of ssh completion.

@ridiculousfish
Copy link
Member

If anyone wants to fix up the print_hostnames regex to handle this case, jump in!

@Luzifer
Copy link
Contributor Author

Luzifer commented Mar 29, 2014

I proposed a fix for this in my pull request. On my system it does work.

@xfix PTAL whether it also works for you…
@ridiculousfish PTAL whether the solution is okay for you…

@Luzifer Luzifer closed this as completed Mar 29, 2014
@zanchey zanchey modified the milestones: next-minor, fish-future Mar 29, 2014
@Pyppe
Copy link

Pyppe commented Aug 28, 2017

I've got fish 2.6.0 (on macOS/iTerm2), and for me the ssh autocomplete doesn't seem to suggest anything for non-standard ports. For example, I've got the following (anonymised) line in my .ssh/known_hosts:

[some.server.com]:10020,[1.2.3.4]:10020 ecdsa-sha2-nistp256 AAAAE2...

But typing ssh some<TAB> yields nothing. Am I missing something, or has this issue regressed?

@zanchey
Copy link
Member

zanchey commented Sep 9, 2017

Yes, this regressed in fbd53f2. I'll open a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants