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...
This commit is contained in:
parent
5177db1a58
commit
1be84710d2
@ -229,7 +229,7 @@ quote_readline()
|
|||||||
# This function shell-dequotes the argument
|
# This function shell-dequotes the argument
|
||||||
dequote()
|
dequote()
|
||||||
{
|
{
|
||||||
eval echo "$1"
|
eval echo "$1" 2> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the word to complete.
|
# Get the word to complete.
|
||||||
|
@ -95,7 +95,24 @@ lappend expected doo: gee: hus: ike: jar:
|
|||||||
# Append local filenames
|
# Append local filenames
|
||||||
lappend expected config known_hosts "spaced\\\\ \\\\ conf"
|
lappend expected config known_hosts "spaced\\\\ \\\\ conf"
|
||||||
set dir fixtures/scp
|
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
|
sync_after_int
|
||||||
|
@ -48,8 +48,8 @@ set expected [get_hosts]
|
|||||||
# Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf"
|
# Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf"
|
||||||
# Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts
|
# Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts
|
||||||
lappend expected doo gee hus ike jar
|
lappend expected doo gee hus ike jar
|
||||||
set dir fixtures/scp
|
set dir fixtures/sftp
|
||||||
assert_complete_dir $expected "sftp -F 'spaced conf' " $dir
|
assert_complete_dir $expected "sftp -F spaced\\ \\ conf " $dir
|
||||||
|
|
||||||
|
|
||||||
sync_after_int
|
sync_after_int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user