bash-completion icon indicating copy to clipboard operation
bash-completion copied to clipboard

Autocompletion failing for an SSH config including globs matching directories

Open maxclac opened this issue 3 years ago • 2 comments

I am running OpenSSH 8.2 on Ubuntu 20.04. I would like to structure my .ssh/config file so that it includes directories with subdirectories:

Include config.d/*
Include config.d/dir1/*
Include config.d/dir2/*
Include config.d/dir3/*

If I have a host remotevm and I try the autocompletion when I type ssh remotevm, I get the following error:

$ ssh remosed: read error on /home/user/.ssh/config.d/dir1: Is a directory
sed: read error on /home/user/.ssh/config.d/dir2: Is a directory
sed: read error on /home/user/.ssh/config.d/dir3: Is a directory
awk: read error (Is a directory)

What can I do so that the autocompletion works again like before?

Best regards

$ echo "$BASH_VERSION"
5.0.17(1)-release
$ (IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}")
2.10

maxclac avatar Nov 24 '21 09:11 maxclac

Confirmed still happening with current master.

There's an easy workaround though; construct your globs so that they don't match any dirs. So for example name your confs *.conf, and Include them as .../*.conf instead of .../* (and be sure you don't have any dirs matching .../*.conf there).

I'm actually somewhat surprised if your config works without problems with ssh itself.

scop avatar Nov 24 '21 21:11 scop

Thank you for the tip!

maxclac avatar Nov 25 '21 14:11 maxclac