[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 8455b7ef38b151ef081cad873171eb4ee1faa20f

Freddy Vulto fvulto at gmail.com
Sat Oct 3 21:28:18 UTC 2009


The following commit has been merged in the master branch:
commit d3187b6f351034f5317b78a9bab60dff7e707b17
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Sat Oct 3 23:23:48 2009 +0200

    Bugfix completing scp/sftp/ssh -F '' on bash-4
    Use ${COMP_LINE:0:$COMP_POINT} instead of ${COMP_WORDS[@]} when searching for
    -F configfile in scp/sftp/ssh.  This fixes a bug under bash-4 where completing:
    
       scp -F 'spaced  conf' <TAB>
    
    causes `dequote' to yield errors:
    
        bash: eval: line 1: unexpected EOF while looking for matching `''
        bash: eval: line 2: syntax error: unexpected end of file
    
    The bug occurs because of a bug in bash-4.0, where quoted words are split
    unintended, see: http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
    
    Also, using ${COMP_LINE:0:$COMP_POINT} is an improvement, because it takes the
    current cursor position into account.

diff --git a/contrib/ssh b/contrib/ssh
index 2070c23..4cb331b 100644
--- a/contrib/ssh
+++ b/contrib/ssh
@@ -83,7 +83,7 @@ _ssh()
 			-i -L -l -m -O -o -p -R -S -w' -- "$cur" ) )
 	else
 		# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
-		set -- "${COMP_WORDS[@]}"
+		set -- "${COMP_LINE:0:$COMP_POINT}"
 		while [ $# -gt 0 ]; do
 			if [ "${1:0:2}" = -F ]; then
 				if [ ${#1} -gt 2 ]; then
@@ -138,7 +138,7 @@ _sftp()
 			-- "$cur" ) )
 	else
 		# Search COMP_WORDS for '-F configfile' argument
-		set -- "${COMP_WORDS[@]}"
+		set -- "${COMP_LINE:0:$COMP_POINT}"
 		while [ $# -gt 0 ]; do
 			if [ "${1:0:2}" = -F ]; then
 				if [ ${#1} -gt 2 ]; then
@@ -196,7 +196,7 @@ _scp()
 		prefix=-F
 	else
 		# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
-		set -- "${COMP_WORDS[@]}"
+		set -- "${COMP_LINE:0:$COMP_POINT}"
 		while [ $# -gt 0 ]; do
 			if [ "${1:0:2}" = -F ]; then
 				if [ ${#1} -gt 2 ]; then

-- 
bash-completion



More information about the Bash-completion-commits mailing list