[Bash-completion-devel] Bug#504650: bash-completion: Bug in _known_hosts concerning subsequent whitespace in UserKnownHostsFile or GlobalKnownHostsFile

Freddy Vulto fvulto at gmail.com
Wed Nov 5 21:54:44 UTC 2008


Package: bash-completion
Version: 20080705
Severity: normal

If UserKnownHostFile or GlobalKnownHostsFile in ssh config file contains multiple subsequent spaces, e.g. 'spaced  hosts' (two spaces), _known_hosts fails.  Solution is to quote the sed output.  See attached diff.

Regards,
Freddy Vulto

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-6-686
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
-------------- next part --------------
=== modified file 'bash_completion'
--- bash_completion	2008-11-01 11:32:22 +0000
+++ bash_completion	2008-11-05 21:43:50 +0000
@@ -2559,9 +2559,9 @@
 
 	if [ ${#config[@]} -gt 0 ]; then
 	    # expand path (if present) to global known hosts file
-	    global_kh=$( eval echo $( sed -ne 's/^[ \t]*[Gg][Ll][Oo][Bb][Aa][Ll][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
+	    global_kh=$( eval echo "$( sed -ne 's/^[ \t]*[Gg][Ll][Oo][Bb][Aa][Ll][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" )" )
 	    # expand path (if present) to user known hosts file
-	    user_kh=$( eval echo $( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
+	    user_kh=$( eval echo "$( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" )" )
 	fi
 
 	# Global known_hosts files


More information about the Bash-completion-devel mailing list