Merge branch 'space-fix': Fix tests when BASH_COMPLETION or TESTDIR contain
spaces. Conflicts: CHANGES
This commit is contained in:
commit
ebdd9cefdc
1
CHANGES
1
CHANGES
@ -69,6 +69,7 @@ bash-completion (2.x)
|
|||||||
* Fix NFS mounts completion (Alioth: #312285).
|
* Fix NFS mounts completion (Alioth: #312285).
|
||||||
* Fix completion of usernames (Alioth: #311396, Debian: #511788).
|
* Fix completion of usernames (Alioth: #311396, Debian: #511788).
|
||||||
* Fix chown test crashing on systems with no root group (Alioth: #312306).
|
* Fix chown test crashing on systems with no root group (Alioth: #312306).
|
||||||
|
* Fixed tests when BASH_COMPLETION or TESTDIR contain spaces.
|
||||||
|
|
||||||
[ Raphaël Droz ]
|
[ Raphaël Droz ]
|
||||||
* Add xsltproc completion (Alioth: #311843).
|
* Add xsltproc completion (Alioth: #311843).
|
||||||
|
@ -1810,7 +1810,7 @@ _filedir_xspec()
|
|||||||
|
|
||||||
# get first exclusion compspec that matches this command
|
# get first exclusion compspec that matches this command
|
||||||
xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print \$0; exit }" \
|
xspec=$( awk "/^complete[ \t]+.*[ \t]${1##*/}([ \t]|\$)/ { print \$0; exit }" \
|
||||||
$BASH_COMPLETION )
|
"$BASH_COMPLETION" )
|
||||||
# prune to leave nothing but the -X spec
|
# prune to leave nothing but the -X spec
|
||||||
xspec=${xspec#*-X }
|
xspec=${xspec#*-X }
|
||||||
xspec=${xspec%% *}
|
xspec=${xspec%% *}
|
||||||
@ -1837,7 +1837,7 @@ _filedir_xspec()
|
|||||||
|
|
||||||
COMPREPLY=( "${toks[@]}" )
|
COMPREPLY=( "${toks[@]}" )
|
||||||
}
|
}
|
||||||
list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' $BASH_COMPLETION | \
|
list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' "$BASH_COMPLETION" | \
|
||||||
# read exclusion compspecs
|
# read exclusion compspecs
|
||||||
(
|
(
|
||||||
while read line
|
while read line
|
||||||
@ -1863,19 +1863,19 @@ unset list
|
|||||||
# source completion directory definitions
|
# source completion directory definitions
|
||||||
if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \
|
if [[ -d $BASH_COMPLETION_COMPAT_DIR && -r $BASH_COMPLETION_COMPAT_DIR && \
|
||||||
-x $BASH_COMPLETION_COMPAT_DIR ]]; then
|
-x $BASH_COMPLETION_COMPAT_DIR ]]; then
|
||||||
for i in $(LC_ALL=C command ls $BASH_COMPLETION_COMPAT_DIR); do
|
for i in $(LC_ALL=C command ls "$BASH_COMPLETION_COMPAT_DIR"); do
|
||||||
i=$BASH_COMPLETION_COMPAT_DIR/$i
|
i=$BASH_COMPLETION_COMPAT_DIR/$i
|
||||||
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \
|
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \
|
||||||
&& ( -f $i || -h $i ) && -r $i ]] && . $i
|
&& ( -f $i || -h $i ) && -r $i ]] && . "$i"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \
|
if [[ $BASH_COMPLETION_DIR != $BASH_COMPLETION_COMPAT_DIR && \
|
||||||
-d $BASH_COMPLETION_DIR && -r $BASH_COMPLETION_DIR && \
|
-d $BASH_COMPLETION_DIR && -r $BASH_COMPLETION_DIR && \
|
||||||
-x $BASH_COMPLETION_DIR ]]; then
|
-x $BASH_COMPLETION_DIR ]]; then
|
||||||
for i in $(LC_ALL=C command ls $BASH_COMPLETION_DIR); do
|
for i in $(LC_ALL=C command ls "$BASH_COMPLETION_DIR"); do
|
||||||
i=$BASH_COMPLETION_DIR/$i
|
i=$BASH_COMPLETION_DIR/$i
|
||||||
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \
|
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|*.rpm@(orig|new|save)) \
|
||||||
&& ( -f $i || -h $i ) && -r $i ]] && . $i
|
&& ( -f $i || -h $i ) && -r $i ]] && . "$i"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
unset i
|
unset i
|
||||||
|
@ -17,7 +17,7 @@ _mount()
|
|||||||
[[ "$cur" == \\ ]] && cur="/"
|
[[ "$cur" == \\ ]] && cur="/"
|
||||||
|
|
||||||
if [[ "$cur" == *:* ]]; then
|
if [[ "$cur" == *:* ]]; then
|
||||||
for sm in $(type -P showmount) {,/usr}/{,s}bin/showmount; do
|
for sm in "$(type -P showmount)" {,/usr}/{,s}bin/showmount; do
|
||||||
[ -x "$sm" ] || continue
|
[ -x "$sm" ] || continue
|
||||||
COMPREPLY=( $( compgen -W "$( "$sm" -e ${cur%%:*} | \
|
COMPREPLY=( $( compgen -W "$( "$sm" -e ${cur%%:*} | \
|
||||||
awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) )
|
awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) )
|
||||||
|
@ -112,7 +112,7 @@ if {[match_items [lsort -unique $expected] $test]} {
|
|||||||
if {[lindex $::BASH_VERSINFO 0] >= 4} {xfail "$test"} {fail "$test"}
|
if {[lindex $::BASH_VERSINFO 0] >= 4} {xfail "$test"} {fail "$test"}
|
||||||
}; # if
|
}; # if
|
||||||
sync_after_int $prompt
|
sync_after_int $prompt
|
||||||
assert_bash_exec "cd \$TESTDIR"
|
assert_bash_exec {cd "$TESTDIR"}
|
||||||
|
|
||||||
|
|
||||||
sync_after_int
|
sync_after_int
|
||||||
|
@ -42,7 +42,7 @@ expect {
|
|||||||
default { unresolved "$test" }
|
default { unresolved "$test" }
|
||||||
}; # expect
|
}; # expect
|
||||||
sync_after_int $prompt
|
sync_after_int $prompt
|
||||||
assert_bash_exec "cd \$TESTDIR"
|
assert_bash_exec {cd "$TESTDIR"}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ expect {
|
|||||||
default { unresolved "$test" }
|
default { unresolved "$test" }
|
||||||
}; # expect
|
}; # expect
|
||||||
sync_after_int $prompt
|
sync_after_int $prompt
|
||||||
assert_bash_exec "cd \$TESTDIR"
|
assert_bash_exec {cd "$TESTDIR"}
|
||||||
|
|
||||||
|
|
||||||
teardown
|
teardown
|
||||||
|
@ -29,7 +29,7 @@ expect {
|
|||||||
default { unresolved "$test" }
|
default { unresolved "$test" }
|
||||||
}; # expect
|
}; # expect
|
||||||
sync_after_int $prompt
|
sync_after_int $prompt
|
||||||
assert_bash_exec "cd \$TESTDIR"
|
assert_bash_exec {cd "$TESTDIR"}
|
||||||
|
|
||||||
|
|
||||||
sync_after_int
|
sync_after_int
|
||||||
@ -84,7 +84,7 @@ expect {
|
|||||||
default { unresolved "$test" }
|
default { unresolved "$test" }
|
||||||
}; # expect
|
}; # expect
|
||||||
sync_after_int $prompt
|
sync_after_int $prompt
|
||||||
assert_bash_exec "cd \$TESTDIR"
|
assert_bash_exec {cd "$TESTDIR"}
|
||||||
|
|
||||||
|
|
||||||
sync_after_int
|
sync_after_int
|
||||||
|
@ -102,7 +102,7 @@ proc assert_bash_list_dir {expected cmd dir {test ""} {prompt /@} {size 20}} {
|
|||||||
assert_bash_exec "cd $dir" "" $prompt
|
assert_bash_exec "cd $dir" "" $prompt
|
||||||
assert_bash_list $expected $cmd $test $prompt $size
|
assert_bash_list $expected $cmd $test $prompt $size
|
||||||
sync_after_int $prompt
|
sync_after_int $prompt
|
||||||
assert_bash_exec "cd \$TESTDIR"
|
assert_bash_exec {cd "$TESTDIR"}
|
||||||
}; # assert_bash_list_dir()
|
}; # assert_bash_list_dir()
|
||||||
|
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ proc assert_complete_dir {expected cmd dir {test ""} {size 20} {cword ""}} {
|
|||||||
assert_bash_exec "cd $dir" "" $prompt
|
assert_bash_exec "cd $dir" "" $prompt
|
||||||
assert_complete $expected $cmd $test $prompt $size $cword
|
assert_complete $expected $cmd $test $prompt $size $cword
|
||||||
sync_after_int $prompt
|
sync_after_int $prompt
|
||||||
assert_bash_exec "cd \$TESTDIR"
|
assert_bash_exec {cd "$TESTDIR"}
|
||||||
}; # assert_complete_dir
|
}; # assert_complete_dir
|
||||||
|
|
||||||
|
|
||||||
@ -692,16 +692,16 @@ proc save_env {{file ""}} {
|
|||||||
# @param string File to save the environment to. Default is "$TESTDIR/tmp/env1~".
|
# @param string File to save the environment to. Default is "$TESTDIR/tmp/env1~".
|
||||||
# @see assert_env_unmodified()
|
# @see assert_env_unmodified()
|
||||||
proc _save_env {{file ""}} {
|
proc _save_env {{file ""}} {
|
||||||
assert_bash_exec "{ set; declare -F; shopt -p; } > $file"
|
assert_bash_exec "{ set; declare -F; shopt -p; } > \"$file\""
|
||||||
}; # _save_env()
|
}; # _save_env()
|
||||||
|
|
||||||
|
|
||||||
# Source bash_completion package
|
# Source bash_completion package
|
||||||
proc source_bash_completion {} {
|
proc source_bash_completion {} {
|
||||||
assert_bash_exec {BASH_COMPLETION_DIR=$(cd $TESTDIR/..; pwd)/contrib}
|
assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$TESTDIR/.."; pwd)/contrib}
|
||||||
assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR}
|
assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR}
|
||||||
assert_bash_exec {BASH_COMPLETION=$(cd $TESTDIR/..; pwd)/bash_completion}
|
assert_bash_exec {BASH_COMPLETION=$(cd "$TESTDIR/.."; pwd)/bash_completion}
|
||||||
assert_bash_exec {source $BASH_COMPLETION}
|
assert_bash_exec {source "$BASH_COMPLETION"}
|
||||||
}; # source_bash_completion()
|
}; # source_bash_completion()
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ expect {
|
|||||||
-re eof { unresolved "eof" }
|
-re eof { unresolved "eof" }
|
||||||
}; # expect
|
}; # expect
|
||||||
sync_after_int $prompt
|
sync_after_int $prompt
|
||||||
assert_bash_exec "cd \$TESTDIR"
|
assert_bash_exec {cd "$TESTDIR"}
|
||||||
|
|
||||||
#assert_bash_list_dir {a\\\'b/c} $cmd fixtures/compgen
|
#assert_bash_list_dir {a\\\'b/c} $cmd fixtures/compgen
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user