[Bash-completion-devel] Bug#848125: bash-completion: Patch to allow '+' in (ssh/know_hosts) hostnames

Vincent Danjean vdanjean at debian.org
Wed Dec 14 10:46:57 UTC 2016


Package: bash-completion
Version: 1:2.1-4.3
Severity: normal
Tags: patch

  Hi,

  I'm using automatic gateway with ssh (and ProxyCommand) so that
ssh gw1+gw2+host will correctly setup a connection first to gw1,
then to gw2 (via gw1 and ProxyCommand) and eventually with host
(via gw2 and ProxyCommand) whatever gw1, gw2 and host are.
  To do that, I need the '+' character in ssh hostname. It works perfectly
with ssh, scp, rsync, ... but not with bash-completion. The reason is that
the '+' is not escaped when a regexp for awk is built in _known_hosts_real.

  The patch is really simple:
=======
diff --git a/bash_completion b/bash_completion
index 6d3ba76..c640278 100644
--- a/bash_completion
+++ b/bash_completion
@@ -1484,6 +1496,7 @@ _known_hosts_real()
         # Escape slashes and dots in paths for awk
         awkcur=${cur//\//\\\/}
         awkcur=${awkcur//\./\\\.}
+        awkcur=${awkcur//\+/\\\+}
         curd=$awkcur
 
         if [[ "$awkcur" == [0-9]*[.:]* ]]; then
======= 

  Note that the line number to apply this patch can be a bit changed
(all Debian quilt patch are currently applied in my source tree, so git
show lots of other unrelated changes)
  I also tried to apply my one-liner patch directly to
/usr/share/bash-completion/bash-completion on my system. I can now
autocomplete hostnames with '+' in them.

  Regards,
    Vincent


-- System Information:
Debian Release: stretch/sid
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (200, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armel, mipsel

Kernel: Linux 4.8.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages bash-completion depends on:
ii  bash  4.4-2
ii  dpkg  1.18.15

bash-completion recommends no packages.

bash-completion suggests no packages.

-- no debconf information



More information about the Bash-completion-devel mailing list