Bug 502745 - bash completion doesn't work on remote files/directories with scp
bash completion doesn't work on remote files/directories with scp
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: bash-completion (Show other bugs)
11
All Linux
low Severity medium
: ---
: ---
Assigned To: Ville Skyttä
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-27 00:41 EDT by Martin King
Modified: 2010-04-27 15:15 EDT (History)
4 users (show)

See Also:
Fixed In Version: 1.1-4.fc11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-04-27 15:15:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Martin King 2009-05-27 00:41:29 EDT
Description of problem:

bash completion doesn't seem to work on remote files/directories with scp, with ssh keys setup between the two systems (using F11) 

Version-Release number of selected component (if applicable):
bash-completion-1.0-2.fc11.noarch


How reproducible:


Steps to Reproduce:
1. setup ssh keys authentication between two systems
2. type scp remotehostname:~/[tab]

  
Actual results:

the above tab-completes to 

scp remotehostname:/home/localusername/

Expected results:
scp remotehostname:/home/remoteusername

or 

as I am trying to connect to my lady friend's powerbook:
scp remotehostname:/Users/remoteusername

trying 
scp remotehostname:/U[tab] 

simply doesn't complete to anything. 

Additional info:

Note: I don't believe this is the same problem as bug 444466, as the symptoms are not the same but have tried uninstalling gvfs anyway, without success. the tab completion is working fine for the hostname part at least...
Comment 1 Ville Skyttä 2009-05-27 02:12:43 EDT
These are probably two entirely different issues.  Let's look at the latter first: I can't reproduce, it works fine for me on F-10.  Do a "set -x" in the shell before invoking the completion and look at the output and possibly post it here.  And try what the following outputs:

ssh -o 'BatchMode yes' remotehostname command ls -aF1d '/U*'

Also, you are hitting tab many enough times, right?  One might not be enough.
Comment 2 Martin King 2009-05-27 09:05:18 EDT
Hi -- Thanks for looking at this so quickly.
Yup - definitely hitting tab enough times. The problem is that it is completing on the local filesystem rather than the remote one.

That is, when typing 
scp remotehost:~/[tab] 

the '~/' is getting expanded, rather than 'remotehost:~/'

running with 'set -x' seems to show that, at least from what I can interpret from comparing it to the output from my other system where the completion works (running another distro). Here I have cur=/U, whereas on the working system, I have cur=remotehost:/U

(note, 'bart-wired' = the remotehost below)

scp bart-wired:/U+ local cur userhost path
+ local optconfigfile
+ COMPREPLY=()
++ _get_cword :
++ [[ 2 -eq 0 ]]
++ [[ 17 == \1\7 ]]
++ printf %s /U
+ cur=/U
+ _expand
+ [[ /U == \~*/* ]]
+ [[ /U == \~* ]]
+ [[ /U == *:* ]]
+ set -- scp bart-wired : /U
+ '[' 4 -gt 0 ']'
+ '[' sc = -F ']'
+ shift
+ '[' 3 -gt 0 ']'
+ '[' ba = -F ']'
+ shift
+ '[' 2 -gt 0 ']'
+ '[' : = -F ']'
+ shift
+ '[' 1 -gt 0 ']'
+ '[' /U = -F ']'
+ shift
+ '[' 0 -gt 0 ']'
+ [[ /U == */* ]]
+ local 'IFS=	
'
+ COMPREPLY=("${COMPREPLY[@]}" $( command ls -aF1d $cur* 		    2>/dev/null | sed 		    -e "s/[][(){}<>\",:;^&\!$=?\`|\\ ']/\\\\&/g" 	    -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ))
++ command ls -aF1d '/U*'
++ sed -e 's/[][(){}<>",:;^&\!$=?`|\ '\'']/\\&/g' -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g'
+ return 0


here also is the output of: 
ssh -o 'BatchMode yes' bart-wired command ls -aFld '/U*'

+ ssh -o 'BatchMode yes' bart-wired command ls -aFld '/U*'
drwxrwxr-t   5 root  admin  170 Jun  1  2007 /Users/

Which seems to be working okay.
Comment 3 Ville Skyttä 2009-05-27 12:57:39 EDT
Thanks for the info.  Reported upstream with some more info and my test results (managed to test a bit in a mock Rawhide chroot): https://alioth.debian.org/tracker/index.php?func=detail&aid=311702&group_id=100114&atid=413095

If you wish to test, try replacing _get_cword in /etc/bash_completion with the version from this old bash_completion version:
http://git.debian.org/?p=bash-completion/bash-completion.git;a=blob_plain;f=bash_completion;hb=5b304bb4d6e79781e22fada5bb6a056f35984938

...but be warned that this might break some other things and does not necessarily have anything to do with what we eventually end up doing to this issue upstream.

Oh, and what I thought might have been two distinct issues might actually be this same one after all.
Comment 4 Martin King 2009-05-27 13:56:38 EDT
Thanks -- using the old _get_cword function seems to be working well so far. 
What is especially curious is that F11 _get_cword function is identical to the one in my other, working system (an Ubuntu Jaunty box), except that the 3 printf "%s" ... statements in the fedora version are replaced by echo ...

Changing those printfs for echos didn't seem have any effect (not that I expected it to).

The only other difference, I think, is between the two versions of bash -- on the ubuntu box it is v 3.2
Comment 5 Bug Zapper 2009-06-09 12:37:24 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 11 development cycle.
Changing version to '11'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 6 Bug Zapper 2010-04-27 10:32:24 EDT
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 7 Ville Skyttä 2010-04-27 15:15:35 EDT
I believe this should have been fixed in 1.1; it works for me in F-12.  I don't have a F-11 box to test with any longer but in any case no more bash-completion updates are planned for F-11.

Note You need to log in before you can comment on or make changes to this bug.