tab completion skips files when path begins with ~
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bash-completion (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Tab completion does not list files when the path begins with ~, like so:
ubuntu@
total 8
drwxrwxr-x 2 ubuntu ubuntu 4096 Mar 10 13:15 dir1
drwxrwxr-x 2 ubuntu ubuntu 4096 Mar 10 13:15 Dir2
-rw-rw-r-- 1 ubuntu ubuntu 0 Mar 10 13:15 file
ubuntu@
dir1/ Dir2/ file
ubuntu@
dir1/ Dir2/
For the record:
ubuntu@
compopt +o bashdefault +o default +o dirnames +o filenames +o nospace +o plusdirs ls
ubuntu@
complete -F _longopt ls
ubuntu@
alias ls='ls --color=auto'
I can't tell if this is the same bug as bug 1288031, as I'm only seeing the auto-completion of only directory names when paths begin with ~, not for all paths.
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: bash-completion 1:2.1-2ubuntu2
ProcVersionSign
Uname: Linux 3.13.0-16-generic i686
ApportVersion: 2.13.3-0ubuntu1
Architecture: i386
Date: Mon Mar 10 14:33:50 2014
InstallationDate: Installed on 2014-02-27 (11 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Alpha i386 (20140224)
PackageArchitec
ProcEnviron:
TERM=screen
PATH=(custom, no user)
XDG_RUNTIME_
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: bash-completion
UpgradeStatus: No upgrade log present (probably fresh install)
ubuntu@
bash:
Installed: 4.3-2ubuntu1
Candidate: 4.3-2ubuntu1
Version table:
*** 4.3-2ubuntu1 0
500 http://
100 /var/lib/
Related branches
- Luke Yelavich (community): Needs Fixing
-
Diff: 80 lines (+42/-1)4 files modified.pc/applied-patches (+1/-0)
bash_completion (+11/-1)
debian/patches/quote_readline_by_ref_fixes.patch (+29/-0)
debian/patches/series (+1/-0)
Here's the results of the running tab completion on ~/testdir/ while under set -x:
ubuntu@ trusty- i386:~$ set -x trusty- i386:~$ ls -l ~/testdir/+ local cur prev words cword split @(?([0- 9])<|?( [0-9&]) >?(>)|> &)' words_by_ ref -n '=<>&' cur prev words cword at_cursor_ by_ref '=<>&' words cword cur comp_words_ by_ref '=<>&' words cword 0]=${!ref} ${COMP_ WORDS[i] }' 1]=${!ref} ${COMP_ WORDS[i] }' 2]=${!ref} ${COMP_ WORDS[i] }' ='~/testdir/ ' e\s\t\d\ i\r\/ ]] e\s\t\d\ i\r\/ ]] ("${@:3: 3}")'
ubuntu@
+ _init_completion -s
+ local exclude= flag outx errx inx OPTIND=1
+ getopts n:e:o:i:s flag -s
+ case $flag in
+ split=false
+ exclude+==
+ getopts n:e:o:i:s flag -s
+ COMPREPLY=()
+ local 'redir=
+ _get_comp_
+ local exclude flag i OPTIND=1
+ words=()
+ local cur cword words
+ upargs=()
+ upvars=()
+ local upargs upvars vcur vcword vprev vwords
+ getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword
+ case $flag in
+ exclude='=<>&'
+ getopts c:i:n:p:w: flag -n '=<>&' cur prev words cword
+ [[ 6 -ge 3 ]]
+ case ${!OPTIND} in
+ vcur=cur
+ let 'OPTIND += 1'
+ [[ 6 -ge 4 ]]
+ case ${!OPTIND} in
+ vprev=prev
+ let 'OPTIND += 1'
+ [[ 6 -ge 5 ]]
+ case ${!OPTIND} in
+ vwords=words
+ let 'OPTIND += 1'
+ [[ 6 -ge 6 ]]
+ case ${!OPTIND} in
+ vcword=cword
+ let 'OPTIND += 1'
+ [[ 6 -ge 7 ]]
+ __get_cword_
+ words=()
+ local cword words
+ __reassemble_
+ local exclude i j line ref
+ [[ -n =<>& ]]
+ exclude='=<>&'
+ eval cword=2
++ cword=2
+ [[ -n =<>& ]]
+ line='ls -l ~/testdir/'
+ (( i=0, j=0 ))
+ (( i < 3 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ eval 'words[
++ words[0]=ls
+ line=' -l ~/testdir/'
+ [[ 0 == 2 ]]
+ (( i++, j++ ))
+ (( i < 3 ))
+ [[ 1 -gt 0 ]]
+ [[ -l == +([=<>&]) ]]
+ ref='words[1]'
+ eval 'words[
++ words[1]=-l
+ line=' ~/testdir/'
+ [[ 1 == 2 ]]
+ (( i++, j++ ))
+ (( i < 3 ))
+ [[ 2 -gt 0 ]]
+ [[ ~/testdir/ == +([=<>&]) ]]
+ ref='words[2]'
+ eval 'words[
++ words[2]
+ line=
+ [[ 2 == 2 ]]
+ eval cword=2
++ cword=2
+ (( i++, j++ ))
+ (( i < 3 ))
+ [[ 3 == 2 ]]
+ local i cur index=16 'lead=ls -l ~/testdir/'
+ [[ 16 -gt 0 ]]
+ [[ -n ls -l ~/testdir/ ]]
+ [[ -n ls-l~/testdir/ ]]
+ cur='ls -l ~/testdir/'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 16 -ge 2 ]]
+ [[ ls != \l\s ]]
+ [[ 0 -lt 2 ]]
+ local old_size=16
+ cur=' -l ~/testdir/'
+ local new_size=14
+ index=14
+ (( ++i ))
+ (( i <= cword ))
+ [[ 14 -ge 2 ]]
+ [[ - != \-\l ]]
+ cur='-l ~/testdir/'
+ (( index-- ))
+ [[ 13 -ge 2 ]]
+ [[ -l != \-\l ]]
+ [[ 1 -lt 2 ]]
+ local old_size=13
+ cur=' ~/testdir/'
+ local new_size=11
+ index=11
+ (( ++i ))
+ (( i <= cword ))
+ [[ 11 -ge 10 ]]
+ [[ ~/testdir != \~\/\t\
+ cur='~/testdir/'
+ (( index-- ))
+ [[ 10 -ge 10 ]]
+ [[ ~/testdir/ != \~\/\t\
+ [[ 2 -lt 2 ]]
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n ~/testdir/ ]]
+ [[ ! -n ~/testdir/ ]]
+ [[ 10 -lt 0 ]]
+ local words cword cur
+ _upvars -a3 words ls -l '~/testdir/' -v cword 2 -v cur '~/testdir/'
+ (( 11 ))
+ (( 11 ))
+ case $1 in
+ [[ -n 3 ]]
+ printf %d 3
+ [[ -n words ]]
+ unset -v words
+ eval 'words=
++ words=("${@:3:3}")
+ shift 5
+ (( 6 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=2
+ shift 3
+ (( 3 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur='~/testdir/'
+ s...