Fix known hosts completion for IPv6 addresses whose last 16 bits are digits (Alioth: #312695, RedHat: #630658).
This commit is contained in:
parent
7f5c64e580
commit
9341a1131c
2
CHANGES
2
CHANGES
@ -22,6 +22,8 @@ bash-completion (2.x)
|
|||||||
* Drop bad kompare filename completion (Alioth: #312708).
|
* Drop bad kompare filename completion (Alioth: #312708).
|
||||||
* Make _filedir and _filedir_xspec complete uppercase versions of their
|
* Make _filedir and _filedir_xspec complete uppercase versions of their
|
||||||
filename extension arguments in addition to exact case matches.
|
filename extension arguments in addition to exact case matches.
|
||||||
|
* Fix known hosts completion for IPv6 addresses whose last 16 bits are digits
|
||||||
|
(Alioth: #312695, RedHat: #630658).
|
||||||
|
|
||||||
[ Freddy Vulto ]
|
[ Freddy Vulto ]
|
||||||
* Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095)
|
* Added _tilde(), fix ~username completion (Alioth: #312613, Debian: #587095)
|
||||||
|
@ -1298,8 +1298,7 @@ _known_hosts_real()
|
|||||||
COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","}
|
COMPREPLY=( "${COMPREPLY[@]}" $( awk 'BEGIN {FS=","}
|
||||||
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
|
/^\s*[^|\#]/ {for (i=1; i<=2; ++i) { \
|
||||||
gsub(" .*$", "", $i); \
|
gsub(" .*$", "", $i); \
|
||||||
gsub("[\\[\\]]", "", $i); \
|
sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
|
||||||
gsub(":[0-9]+$", "", $i); \
|
|
||||||
if ($i ~ /'"$awkcur"'/) {print $i} \
|
if ($i ~ /'"$awkcur"'/) {print $i} \
|
||||||
}}' "${kh[@]}" 2>/dev/null ) )
|
}}' "${kh[@]}" 2>/dev/null ) )
|
||||||
fi
|
fi
|
||||||
|
2
test/fixtures/_known_hosts_real/known_hosts
vendored
2
test/fixtures/_known_hosts_real/known_hosts
vendored
@ -6,3 +6,5 @@ jub,10.0.0.1
|
|||||||
kyl,100.0.0.2
|
kyl,100.0.0.2
|
||||||
[10.10.0.3]:10022
|
[10.10.0.3]:10022
|
||||||
[blah]:1234
|
[blah]:1234
|
||||||
|
fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555
|
||||||
|
fe80::123:0xff:dead:beef%eth0
|
||||||
|
@ -17,8 +17,8 @@ setup
|
|||||||
set test "Hosts should be put in COMPREPLY"
|
set test "Hosts should be put in COMPREPLY"
|
||||||
set hosts [get_hosts]
|
set hosts [get_hosts]
|
||||||
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
|
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
|
||||||
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3 and blah in ./fixtures/_known_hosts_real/known_hosts
|
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 and fe80::123:0xff:dead:beef%eth0 in ./fixtures/_known_hosts_real/known_hosts
|
||||||
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3
|
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0
|
||||||
set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY}
|
set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY}
|
||||||
assert_bash_list $hosts $cmd $test
|
assert_bash_list $hosts $cmd $test
|
||||||
|
|
||||||
@ -29,8 +29,8 @@ sync_after_int
|
|||||||
set test "Hosts should have username prefix and colon suffix"
|
set test "Hosts should have username prefix and colon suffix"
|
||||||
set hosts [get_hosts]
|
set hosts [get_hosts]
|
||||||
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
|
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
|
||||||
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3 and blah in ./fixtures/_known_hosts_real/known_hosts
|
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 and fe80::123:0xff:dead:beef%eth0 in ./fixtures/_known_hosts_real/known_hosts
|
||||||
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3
|
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0
|
||||||
set hosts [lsort -ascii $hosts]
|
set hosts [lsort -ascii $hosts]
|
||||||
set expected {}
|
set expected {}
|
||||||
foreach host $hosts {
|
foreach host $hosts {
|
||||||
@ -103,8 +103,8 @@ set test "Empty COMP_KNOWN_HOSTS_WITH_HOSTFILE should omit HOSTFILE"
|
|||||||
assert_bash_exec "COMP_KNOWN_HOSTS_WITH_HOSTFILE="
|
assert_bash_exec "COMP_KNOWN_HOSTS_WITH_HOSTFILE="
|
||||||
set hosts [get_hosts_avahi]
|
set hosts [get_hosts_avahi]
|
||||||
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
|
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
|
||||||
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3 and blah in ./fixtures/_known_hosts_real/known_hosts
|
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 and fe80::123:0xff:dead:beef%eth0 in ./fixtures/_known_hosts_real/known_hosts
|
||||||
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3
|
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0
|
||||||
# Call _known_hosts
|
# Call _known_hosts
|
||||||
set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY}
|
set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY}
|
||||||
assert_bash_list $hosts $cmd $test
|
assert_bash_list $hosts $cmd $test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user