[Bash-completion-commits] [SCM] bash-completion branch, master, updated. bb47efd9b6d5717434d4d85c4a31bcd6787def97
Freddy Vulto
fvulto at gmail.com
Sun Oct 4 16:23:41 UTC 2009
The following commit has been merged in the master branch:
commit 1be84710d2ac941ef9dee13f3dd9cd28ca6c5ba6
Author: Freddy Vulto <fvulto at gmail.com>
Date: Sun Oct 4 18:14:16 2009 +0200
Silence completing scp/sftp/ssh -F '' on bash-4
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
Workaround is now to silence `dequote' in case of errors and wait for bash-4 to
be fixed...
diff --git a/bash_completion b/bash_completion
index 3cacea7..41636fa 100644
--- a/bash_completion
+++ b/bash_completion
@@ -229,7 +229,7 @@ quote_readline()
# This function shell-dequotes the argument
dequote()
{
- eval echo "$1"
+ eval echo "$1" 2> /dev/null
}
# Get the word to complete.
diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp
index d16741a..5388383 100644
--- a/test/lib/completions/scp.exp
+++ b/test/lib/completions/scp.exp
@@ -95,7 +95,24 @@ lappend expected doo: gee: hus: ike: jar:
# Append local filenames
lappend expected config known_hosts "spaced\\\\ \\\\ conf"
set dir fixtures/scp
-assert_complete_dir $expected "scp -F 'spaced conf' " $dir
+#assert_complete_dir $expected "scp -F 'spaced conf' " $dir
+set prompt "/$dir/@"
+assert_bash_exec "cd $dir" "" $prompt
+set cmd "scp -F 'spaced conf' "
+send "$cmd\t"
+expect -ex "$cmd\r\n"
+if {[match_items $expected $test]} {
+ expect {
+ -re $prompt { pass "$test" }
+ -re eof { unresolved "eof" }
+ }; # expect
+} else {
+ # Expected failure (known bug) because of bash-4 bug in quoted words:
+ # http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
+ if {$bash_versinfo_0 >= 4} {xfail "$test"} {fail "$test"}
+}; # if
+sync_after_int $prompt
+assert_bash_exec "cd \$TESTDIR"
sync_after_int
diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp
index 7cd89c0..59faaab 100644
--- a/test/lib/completions/sftp.exp
+++ b/test/lib/completions/sftp.exp
@@ -48,8 +48,8 @@ set expected [get_hosts]
# Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf"
# Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts
lappend expected doo gee hus ike jar
-set dir fixtures/scp
-assert_complete_dir $expected "sftp -F 'spaced conf' " $dir
+set dir fixtures/sftp
+assert_complete_dir $expected "sftp -F spaced\\ \\ conf " $dir
sync_after_int
--
bash-completion
More information about the Bash-completion-commits
mailing list