[Bash-completion-devel] scp remote path completion broken?
Freddy Vulto
fvulto at gmail.com
Thu Sep 17 19:26:50 UTC 2009
I've been mixing up bash-3 and bash-4 :-( But now I know, these are
my findings:
Commit f6497298 actually fixed quoted arguments under bash-3.
Bug #474094 is actually fixed under bash-3, but reappears under bash-4
as it did at my box...
It appears the contents of COMP_CWORDS has changed as of bash-4:
"The programmable completion code now uses the same set of characters as
readline when breaking the command line into a list of words."
This affects quoted arguments. When completing this:
$ a 'b c<TAB>
bash-3 is returning this:
COMP_CWORD: 1
COMP_CWORDS:
0: a
1: 'b c
whereas bash-4 is returning:
COMP_CWORD: 3
COMP_CWORDS:
0: a
1: '
2: b
3: c
The old _get_cword gives better results on bash-4 because it's not
relying on COMP_CWORDS and allows for temporarily disabling of
COMP_WORDBREAKS characters. But the old _get_cword fails on bash-4
with quoted arguments.
I tried fixing _get_cword with quoted arguments under bash-4, but it's
becoming rather difficult since quotes can be escaped in so many ways
and COMP_WORDS is of so little help now. I'm going to ask on the
bug-bash mailing list for a KISS solution.
In the mean time I'll restore _get_cword like this:
if bash-4
old _get_cword using COMP_WORDBREAKS (dubbed _get_cword4)
else
_get_cword of commit f6497298 (dubbed _get_cword3)
fi
Meaning that under bash-4, _get_cword of quoted arguments will go
wrong. All other _get_cwords should give no problems on bash-3 &
bash-4...
Regards,
Freddy Vulto
http://fvue.nl
More information about the Bash-completion-devel
mailing list