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.
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
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