The following commit has been merged in the master branch:
commit 76de7c2984a9bf7b3e6a64c70a288fb38a651f32
Author: Ville Skyttä <[email protected]>
Date:   Thu Nov 26 23:30:04 2009 +0200

    Fix handling of known hosts files starting with ~.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=541423#c3
    
    Done by adding the eval back.  The only thing that this breaks AFAIK
    is handling of known hosts filenames that have more than one
    consecutive space in them, but I couldn't figure out how to get both
    to work and IMO support for files starting with ~ is much more
    important.

diff --git a/bash_completion b/bash_completion
index 9cee425..e3b782c 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1260,9 +1260,12 @@ _known_hosts_real()
         local OIFS=$IFS IFS=$'\n'
         local -a tmpkh
         # expand paths (if present) to global and user known hosts files
-        tmpkh=( $( sed -ne 's/^[ 
\t]*\([Gg][Ll][Oo][Bb][Aa][Ll]\|[Uu][Ss][Ee][Rr]\)[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t
 '"']*\(.*\)$/"\2"/p' "${conf...@]}" ) )
-        for i in "${tmp...@]}"; do
-            i=$( echo "${i//\"/}" )
+        # TODO(?): try to make known hosts files with more than one consecutive
+        #          spaces in their name work (watch out for ~ expansion
+        #          breakage! Alioth#311595)
+        tmpkh=( $( sed -ne 's/^[ 
\t]*\([Gg][Ll][Oo][Bb][Aa][Ll]\|[Uu][Ss][Ee][Rr]\)[Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t
 '"']*\(.*\)$/\2/p' "${conf...@]}" ) )
+        for i in "${tmp...@]//\"/}"; do
+            i=$( eval echo "$i" ) # expand ~
             [ -r "$i" ] && kh=( "${...@]}" "$i" )
         done
         IFS=$OIFS

-- 
bash-completion

_______________________________________________
Bash-completion-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits

Reply via email to