Hello Paul,

This bug has already been fixed upstream, but not yet released.  You
can apply attached patch to fix the problem.

See also: https://alioth.debian.org/tracker/?func=detail&aid=311595
(tab "Attachments").

To reproduce the problem:

    $ cat > /tmp/config <<"EOF"
    > Host foo
    >     UserKnownHostsFile "/dev/null"
    >     UserKnownHostsFile "/dev/null"
    > EOF
    $ ssh -F/tmp/config <TAB>
    $ ssh -F/tmp/config bash: /dev/null: Permission denied
    ...

After the patch, completion should succeed without any error "Permission
denied":

    $ ssh -F/tmp/config <TAB>
    ...

Regards,

Freddy Vulto
http://fvue.nl
--- bash_completion.orig	2009-04-02 22:01:39.000000000 +0200
+++ bash_completion	2009-08-14 12:22:41.000000000 +0200
@@ -2666,10 +2666,18 @@
 	fi
 
 	if [ ${#conf...@]} -gt 0 ]; then
+	    local OIFS=$IFS IFS=$'\n'
 	    # 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' "${conf...@]}" )" )
+	    global_kh=($( 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' "${conf...@]}" ))
+	    for (( i=0; i < ${#global_...@]}; i++ )); do
+	    	global_kh[i]=$(echo "${global_kh[i]//\"/}")
+	    done
 	    # 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' "${conf...@]}" )" )
+	    user_kh=($( 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' "${conf...@]}" ))
+	    for (( i=0; i < ${#user_...@]}; i++ )); do
+	    	user_kh[i]=$(echo "${user_kh[i]//\"/}")
+	    done
+	    IFS=$OIFS
 	fi
 
 	# Global known_hosts files
_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel

Reply via email to