[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-505-g333a5a5

Ville Skyttä ville.skytta at iki.fi
Fri Nov 4 22:54:47 UTC 2011


The following commit has been merged in the master branch:
commit 333a5a50bebcbea3f0655351b2f7c57ea195c04a
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Nov 5 00:53:39 2011 +0200

    _known_hosts_real: Handle more than two hostnames per known hosts line (Debian: #647352).

diff --git a/bash_completion b/bash_completion
index 8c8fab5..3bfbf72 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1417,7 +1417,7 @@ _known_hosts_real()
             /^\s*[^|\#]/ {
             sub("^@[^ ]+ +", ""); \
             sub(" .*$", ""); \
-            for (i=1; i<=2; ++i) { \
+            for (i=1; i<=NF; ++i) { \
             sub("^\\[", "", $i); sub("\\](:[0-9]+)?$", "", $i); \
             if ($i ~ /'"$awkcur"'/) {print $i} \
             }}' "${kh[@]}" 2>/dev/null ) )
diff --git a/test/fixtures/_known_hosts_real/known_hosts2 b/test/fixtures/_known_hosts_real/known_hosts2
index f719efd..b0926a4 100644
--- a/test/fixtures/_known_hosts_real/known_hosts2
+++ b/test/fixtures/_known_hosts_real/known_hosts2
@@ -1 +1 @@
-two
+two,two2,two3,two4
diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp
index 0e381fa..d4ba804 100644
--- a/test/unit/_known_hosts_real.exp
+++ b/test/unit/_known_hosts_real.exp
@@ -52,8 +52,8 @@ set test "Files containing consecutive spaces should work"
 set hosts [get_hosts -unsorted]
 set hosts_orig $hosts
     # Hosts `gee' and `hus' are defined in `./fixtures/_known_hosts_real/spaced  conf'
-    # Host `two' is defined in ./fixtures/_known_hosts_real/known_hosts2
-lappend hosts gee hus two
+    # Hosts `two*' are defined in ./fixtures/_known_hosts_real/known_hosts2
+lappend hosts gee hus two two2 two3 two4
 set hosts_config $hosts
     # Hosts `doo' and `ike' are defined in `./fixtures/_known_hosts_/spaced  known_hosts'
 lappend hosts doo ike
@@ -78,9 +78,9 @@ sync_after_int
 
 set test "Files starting with tilde (~) should work"
 set hosts [get_hosts -unsorted]
-    # Host `two' is defined in ./fixtures/_known_hosts_real/known_hosts2
+    # Hosts `two*' are defined in ./fixtures/_known_hosts_real/known_hosts2
     # Host `three' is defined in ./fixtures/_known_hosts_real/known_hosts3
-lappend hosts two three
+lappend hosts two two2 two3 two4 three
 set hosts [join [bash_sort $hosts] "\\s+"]
     # Setup environment
 set cmd {OLDHOME=$HOME; HOME=$SRCDIRABS}

-- 
bash-completion



More information about the Bash-completion-commits mailing list