madsmith / bash-completion-lib

Automatically exported from code.google.com/p/bash-completion-lib
GNU General Public License v2.0
0 stars 0 forks source link

Comments after hostnames in ssh config files aren't ignored #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add lines underneath to ~/.ssh/config:

      Host foo  # Comment
          HostName foo  # Comment2

2. Tab-complete ssh: ssh <TAB>

What is the expected output? What do you see instead?

I'd expect "#", "Comment" and "Comment2" not to appear in the presented
list of hostnames.  Instead, "#", "Comment1" and "Comment2" are listed as
possible completions.

Original issue reported on code.google.com by fvu...@gmail.com on 31 Oct 2008 at 12:28

GoogleCodeExporter commented 8 years ago
Fixed in r72.  The sed expression in _known_hosts now goes like this:

    sed -ne 's/^[ \t]*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t
'"']\+\([^#*?]*\)\(#.*\)\?$/\2/p'

Note that SSH allows a comment after `Host' but not after `HostName'.  In the 
latter
case you'll get an error message when trying to scp/ssh/sftp:

    garbage at end of line; "#".

Original comment by fvu...@gmail.com on 31 Oct 2008 at 10:21