[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 76de7c2984a9bf7b3e6a64c70a288fb38a651f32

Ville Skyttä ville.skytta at iki.fi
Thu Nov 26 21:33:32 UTC 2009


The following commit has been merged in the master branch:
commit 76de7c2984a9bf7b3e6a64c70a288fb38a651f32
Author: Ville Skyttä <ville.skytta at iki.fi>
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' "${config[@]}" ) )
-        for i in "${tmpkh[@]}"; 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' "${config[@]}" ) )
+        for i in "${tmpkh[@]//\"/}"; do
+            i=$( eval echo "$i" ) # expand ~
             [ -r "$i" ] && kh=( "${kh[@]}" "$i" )
         done
         IFS=$OIFS

-- 
bash-completion



More information about the Bash-completion-commits mailing list