Bug 502745 - bash completion doesn't work on remote files/directories with scp
Summary: bash completion doesn't work on remote files/directories with scp
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: bash-completion
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ville Skyttä
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-05-27 04:41 UTC by Martin King
Modified: 2010-04-27 19:15 UTC (History)
4 users (show)

Fixed In Version: 1.1-4.fc11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-04-27 19:15:35 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Martin King 2009-05-27 04:41:29 UTC
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 06:12:43 UTC
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 13:05:18 UTC
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 16:57:39 UTC
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 17:56:38 UTC
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 16:37:24 UTC
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 14:32:24 UTC
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 19:15:35 UTC
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.