[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1da64f602a79745edb121767a2c27ce2e3a4288c
Ville Skyttä
ville.skytta at iki.fi
Mon Oct 4 18:31:41 UTC 2010
The following commit has been merged in the master branch:
commit 1da64f602a79745edb121767a2c27ce2e3a4288c
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon Oct 4 21:29:44 2010 +0300
More known hosts IPv6 completion fixes, thanks to Yoshinori KUNIGA.
https://bugzilla.redhat.com/show_bug.cgi?id=630658#c4
diff --git a/CHANGES b/CHANGES
index dd9574b..d8481e9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -22,8 +22,7 @@ bash-completion (2.x)
* Drop bad kompare filename completion (Alioth: #312708).
* Make _filedir and _filedir_xspec complete uppercase versions of their
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).
+ * IPv6 known hosts completion fixes (Alioth: #312695, RedHat: #630658).
* Improve mplayer and mencoder completions.
* Fixes to completions for filenames containing tabs (RedHat: #629518).
diff --git a/bash_completion b/bash_completion
index e3ae308..e88c662 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1279,16 +1279,16 @@ _known_hosts_real()
awkcur=${awkcur//\./\\\.}
curd=$awkcur
- if [[ "$awkcur" == [0-9]*.* ]]; then
- # Digits followed by a dot - just search for that
- awkcur="^$awkcur.*"
+ if [[ "$awkcur" == [0-9]*[.:]* ]]; then
+ # Digits followed by a dot or a colon - just search for that
+ awkcur="^$awkcur[.:]*"
elif [[ "$awkcur" == [0-9]* ]]; then
- # Digits followed by no dot - search for digits followed
- # by a dot
- awkcur="^$awkcur.*\."
+ # Digits followed by no dot or colon - search for digits followed
+ # by a dot or a colon
+ awkcur="^$awkcur.*[.:]"
elif [ -z "$awkcur" ]; then
- # A blank - search for a dot or an alpha character
- awkcur="[a-z.]"
+ # A blank - search for a dot, a colon, or an alpha character
+ awkcur="[a-z.:]"
else
awkcur="^$awkcur"
fi
diff --git a/test/fixtures/_known_hosts_real/known_hosts b/test/fixtures/_known_hosts_real/known_hosts
index 6501909..f655eaa 100644
--- a/test/fixtures/_known_hosts_real/known_hosts
+++ b/test/fixtures/_known_hosts_real/known_hosts
@@ -8,3 +8,6 @@ kyl,100.0.0.2
[blah]:1234
fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555
fe80::123:0xff:dead:beef%eth0
+1111:2222:3333:4444:5555:6666:xxxx:abab
+11xx:2222:3333:4444:5555:6666:xxxx:abab
+::42
diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp
index 8869de1..c23a9ce 100644
--- a/test/unit/_known_hosts_real.exp
+++ b/test/unit/_known_hosts_real.exp
@@ -17,8 +17,8 @@ setup
set test "Hosts should be put in COMPREPLY"
set hosts [get_hosts]
# 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, 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 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0
+ # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases 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 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY}
assert_bash_list $hosts $cmd $test
@@ -29,8 +29,8 @@ sync_after_int
set test "Hosts should have username prefix and colon suffix"
set hosts [get_hosts]
# 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, 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 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0
+ # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases 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 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
set hosts [lsort -ascii $hosts]
set expected {}
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="
set hosts [get_hosts_avahi]
# 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, 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 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0
+ # doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases 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 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
# Call _known_hosts
set cmd {unset COMPREPLY; _known_hosts_real -aF fixtures/_known_hosts_real/config ''; echo_array COMPREPLY}
assert_bash_list $hosts $cmd $test
--
bash-completion
More information about the Bash-completion-commits
mailing list