bash completion doesn't perform filename processing for ssh -i

Bug #139674 reported by Adam Simpkins
10
Affects Status Importance Assigned to Milestone
bash-completion (Debian)
Fix Released
Unknown
bash-completion (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Binary package hint: bash

In /etc/bash_completion, the completion for the "ssh" command doesn't use the
"-o filenames" option. As a result, filename processing isn't performed on the
completed results. (In particular, this includes adding a trailing slash to
directory names.)

This is nice for most cases, but ssh's "-i" option does take a filename
argument. The lack of filename processing can be rather annoying when trying
to specify a key in a deep path.

Unfortunately, I'm not sure if bash provides an easy way to enable the
"-o filenames" behavior only for certain arguments. I think it may only be
possible to set it on a per-command basis. Therefore the only way to fix this
may be to manually perform this processing in the _filedir() function in
/etc/bash_completion (or perhaps just in the _ssh() function).

Either way, this is a very low priority bug.

Tags: patch trusty
Revision history for this message
Mika Fischer (zoop) wrote :

I'm not sure this is even fixable without changes to bash itself...

Changed in bash-completion:
status: New → Confirmed
Mika Fischer (zoop)
Changed in bash-completion:
importance: Undecided → Low
status: Confirmed → Triaged
Changed in bash-completion:
status: Unknown → Confirmed
Revision history for this message
Eliah Kagan (degeneracypressure) wrote :

What version of bash-completion does this occur with? I have bash 4.1-2ubuntu4 and bash-completion 1:1.2-2ubuntu1 on Maverick amd64, and when I type "ssh -i ~/.ssh/" and then press tab, I see the options:

ek@Apok:~$ ssh -i ~/.ssh/
~/.ssh/id_rsa ~/.ssh/id_rsa.pub ~/.ssh/known_hosts

When I type "ssh -i ~/.ssh/id_rsa." and press tab, it expands to "ssh -i ~/.ssh/id_rsa.pub". So bash-completion works correctly for ssh -i on my system.

Revision history for this message
Daniel Black (daniel-black) wrote :

the function i wrote for ssh-add in #376546 would work here.

Revision history for this message
Daniel Black (daniel-black) wrote :

further to the previous comment, here is the modification to the ssh bash_completion to handle -i searching for keys

This depends on the _ssh-add as per the (second) attachment in bug #376546

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "patch to ssh bash completion" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Changed in bash-completion (Debian):
status: Confirmed → Fix Released
Revision history for this message
Daniel Black (daniel-black) wrote :

updated patches that have been submitted upstream:

https://github.com/grooverdan/bash-completion/tree/ssh-identityfile

Mathew Hodson (mhodson)
tags: added: trusty
removed: bash bashcompletion completion jankunder scp ssh
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.