[Bash-completion-devel] [bash-completion-Bugs][311702] _get_cword ignores optional arg, scp host:path completion broken with bash 4

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Mon Oct 19 02:39:59 UTC 2009


Bugs item #311702, was changed at 2009-05-27 16:47 by Jeremy Olexa
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=311702&group_id=100114

Status: Open
Priority: 3
Submitted By: Ville Skyttä  (scop-guest)
Assigned to: Freddy Vulto (fvu-guest)
Summary: _get_cword ignores optional arg, scp host:path completion broken with bash 4 
Distribution: None
Originally reported in: Fedora / Red Hat Bugzilla
Milestone: None
Status: None
Original bug number: 502745


Initial Comment:
http://git.debian.org/?p=bash-completion/bash-completion.git;a=commitdiff;h=f6497298a4422ac236cfd10ddc05b3ace3961a27

This commit changes _get_cword so that it no longer does what it is documented to do; the optional argument (see comments in code) is ignored by the new implementation.  The commit message "fixed _get_cword()" does not tell much what was wrong with the original version and since it was pretty much completely rewritten it's hard to guess; David, do you remember any details?  Was ignoring the optional argument an oversight?

Current _get_cword does not play nice with scp completion and bash 4 - some splitting occurs after the colon in hostname:path causing path gets completed locally.  I do not observe this problem with bash 3.2.
https://bugzilla.redhat.com/show_bug.cgi?id=502745#c2

If I revert _get_cword to what it was before this commit, it appears to do the right thing with scp completion and bash 4 (can only partially test at the moment, no real scp available in my limited bash 4 test env, and I haven't tested the reverted version with bash 3.x).

----------------------------------------------------------------------

Comment By: Jeremy Olexa (darkside-guest)
Date: 2009-10-19 02:39

Message:
Indeed, I am using bash-completion-1.1.

I am not sure how to be more specific. scp host:<tab> returns nothing on hosts that I have access to via a ssh key. I have the following modules active:

%% ls -1 /etc/bash_completion.d/
base
bash-builtins
bzip2
gcc
genlop
gentoo
git
gzip
imagemagick
man
mercurial
modules
mplayer
ooffice.sh
repoman
screen
ssh
vim
xz

----------------------------------------------------------------------

Comment By: Freddy Vulto (fvu-guest)
Date: 2009-10-17 19:42

Message:
Hello Jeremy,

scp remote path completion in bash-completion-1.1 with bash-4 seems to be working all right on my machine.  Can you be more specific about the problem?
Are you sure you're running bash-completion-1.1 and not 1.0?  You can tell it's 1.1 if _get_cword looks like this:

$ declare -f _get_cword
_get_cword () 
{ 
    if [ -n "$bash4" ]; then
        __get_cword4 "$@";
    else
        __get_cword3;
    fi
}

Regards, Freddy

----------------------------------------------------------------------

Comment By: Jeremy Olexa (darkside-guest)
Date: 2009-10-16 02:13

Message:
scp remote path completion is still broken in bash-completion-1.1 with bash-4

----------------------------------------------------------------------

Comment By: David Paleino (hanska-guest)
Date: 2009-05-27 17:11

Message:
Hello Ville,
no, I can't really remember what was wrong with the old implementation of _get_cword.

Maybe the reverted version didn't play nice with 3.x? I'm currently unable to do any commit (not posting from my computer) :(

Sorry,
David

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=311702&group_id=100114



More information about the Bash-completion-devel mailing list