From: Uwe Kleine-König <u...@kleine-koenig.org>

If there are set some configurations for a host it's activated when a
match on "Host" occurs, but not on "Hostname". If for example the
configuration contains

        Host machine.sd
        Hostname machine.some.domain
        User sduser

then the specified user is only used when running

        $ ssh machine.sd

but not when running

        $ ssh machine.some.domain

. So while machine.some.domain maybe is a valid hostname to connect to,
the user's indention on

        $ ssh machin<tab>

is probably using the configured user and so completing
"machine.some.domain" doesn't make sense.

Just in case this is wrong and someone still wants both names, it's
still possible to add a line

        Host machine.some.domain

to the configuration to get the previous behaviour.

Fixes: http://bugs.debian.org/689585
---
 bash_completion | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bash_completion b/bash_completion
index 8c9fc81..92b950b 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1565,7 +1565,8 @@ _known_hosts_real()
 
     # append any available aliases from config files
     if [[ ${#config[@]} -gt 0 && -n "$aliases" ]]; then
-        local hosts=$( sed -ne 's/^['"$'\t 
'"']*[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\{0,1\}['"$'\t 
'"']\{1,\}\([^#*?%]*\)\(#.*\)\{0,1\}$/\2/p' "${config[@]}" )
+        local hosts=$( sed -ne 's/^['"$'\t '"']*[Hh][Oo][Ss][Tt]['"$'\t 
'"']\{1,\}\([^#*?%]*\)\(#.*\)\{0,1\}$/\1/p' "${config[@]}" )
+
         COMPREPLY+=( $( compgen -P "$prefix$user" \
             -S "$suffix" -W "$hosts" -- "$cur" ) )
     fi
-- 
2.1.3


_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/bash-completion-devel

Reply via email to