bash-completion
bash-completion copied to clipboard
SSH completion with Include directive and subdirectory
Hi,
I've just stumbled upon an issue concerning SSH and its Include directive. I use globbing in my config:
Include ~/.ssh/config.d/**/*
Include ~/.ssh/config.d/*
And bash_completion fails because of subdirectories:
ssh sed: read error on /home/xpayn/.ssh/config.d/private: Is a directory
sed: read error on /home/xpayn/.ssh/config.d/other: Is a directory
awk: cmd. line:1: warning: command line argument `/home/xpayn/.ssh/config.d/private' is a directory: skipped
awk: cmd. line:1: warning: command line argument `/home/xpayn/.ssh/config.d/other' is a directory: skipped
sed: read error on /home/xpayn/.ssh/config.d/private: Is a directory
bash_completion is 2.8 on ubuntu 18.04:
> grep VER /usr/share/bash-completion/bash_completion
BASH_COMPLETION_VERSINFO=(2 8)
> cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
If you need anything else, ping me, I'll try to be reactive. Cheers,
Xavier
I can reproduce it on Debian:
$ apt-cache policy bash-completion
bash-completion:
Installed: 1:2.8-6
$ cat ~/.ssh/config
Include config.d/*
Typing ssh m<TAB> gives:
$ ssh mbash: no match: config.d/*
It only fail with shopt -s failglob, so an shopt -u failglob hides the error.
Reproduced as well. The failglob example in the 2nd post is another issue, failglob on/off isn't enough to hush the original one, so that would be better reported as a separate one here.
Can anyone suggest a workaround for this issue?