[Bug 1372286] Re: unwanted space after directory completion (probably old cruft after upgrades)
Peter Cordes
peter at cordes.ca
Tue Dec 9 16:29:31 UTC 2014
ln -s /tmpX /tmp produces:
lrwxrwxrwx 1 peter peter 5 Dec 9 11:58 /tmp/tmpX -> /tmpX (a broken symlink)
Did you mean ln -s /tmp /tmpX ?
When cooking up a testcase, it's bad practice to make one that only
works for root.
mkdir -p test/tmp
cd test
ln -s ./tmp tmpX
ls ./tmp[TAB] => tmp/ tmpX/
echo ./tmp[TAB] => ditto
ls ./tmpX[TAB] => completes to ./tmpX/ (no space)
echo ./tmpX[TAB] => completes to ./tmpX/ (no space)
$ complete -p ls echo
complete -F _longopt ls
complete -F _minimal echo
so, works for me (even complete -r; .
/.../pristine_ubuntu_trusty_bash_completion, since my normal bash-
completion is git HEAD + my tweaks).
And btw, you're right that it's nothing to do with aliases. Anything
without a specific completion has the shell function _minimal set for it
by the completion dynamic loader. The _longopt function does end up
using the same code to complete file / directory names as _minimal, it
just checks for maybe completing --options first.
Broken symlinks do complete like files (no slash, space added) instead of dirs (slash, no space). Since your ln command doesn't match your examples, maybe that's doing it.
ln -s /nowhere brokenlink
echo ./br[TAB] => ./brokenlink[space]
ls ./br[TAB] => ./brokenlink[space]
I'm not sure how you're getting different behaviour from ls vs. a
generic command. There is something weird going on here. Can you give
ls -l output for the relevant stuff? If you can cook up a testcase that
reproduces this in a tmp directory, that'd be better, otherwise just a
full ls -l of all the relevant stuff on your system will do.
The other thing you can do is
set -x
ls /tmpX[TAB]
set +x
copy and paste the entire output. The interesting part will probably be
where _filedir is called, and after that, but just post the whole output
so we don't need you to understand it yourself. :P
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bash-completion in Ubuntu.
https://bugs.launchpad.net/bugs/1372286
Title:
unwanted space after directory completion (probably old cruft after
upgrades)
Status in bash-completion package in Ubuntu:
Confirmed
Bug description:
With bash-completion 2.1, some users are seeing broken completion for
directories, with a space being added at the end, requiring a
[BACKSPACE]/[TAB].
Testcase copied from bug 1000470, which I'm closing because it was
probably from acroread.sh, which is now blacklisted.
Extra space scenario:
find /op<TAB> ==> find /opt<Space>
Backslash scenario:
cd ~
mkdir -p test\ 1/test
find test\ 1/t<TAB>
find test 1/test
find: `test': No such file or directory
find: `1/test': No such file or directory
This bug can get closed when we find out what other old files get left in /etc/bash_completion.d and cause problems, so we can blacklist them, too.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bash-completion/+bug/1372286/+subscriptions
More information about the foundations-bugs
mailing list