From 76de7c2984a9bf7b3e6a64c70a288fb38a651f32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Thu, 26 Nov 2009 23:30:04 +0200 Subject: [PATCH] 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. --- bash_completion | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bash_completion b/bash_completion index 9cee4250..e3b782c0 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