| Summary: | breaks filename completion if filename has space chars | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Sami Farin <hvtaifwkbgefbaei> |
| Component: | bash-completion | Assignee: | Ville Skyttä <ville.skytta> |
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | sheltren, ville.skytta |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | 1.99-1 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-01-08 12:21:35 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
Works fine for me. Do a "set -x" in a shell, then invoke the completion that fails, and attach the output here. I tried simple "echo jee[tab]j[tab]" and it failed to complete the second one (j[tab])
+ _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=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '=<>&' cur prev words cword
+ 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_at_cursor_by_ref '=<>&' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '=<>&' words cword
+ local exclude i j line ref
+ [[ -n =<>& ]]
+ exclude='=<>&'
+ eval cword=1
++ cword=1
+ [[ -n =<>& ]]
+ line='echo je'
+ (( i=0, j=0 ))
+ (( i < 2 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ eval 'words[0]=${!ref}${COMP_WORDS[i]}'
++ words[0]=echo
+ line=' je'
+ [[ 0 == 1 ]]
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 1 -gt 0 ]]
+ [[ -n je ]]
+ [[ '' == je ]]
+ ref='words[1]'
+ eval 'words[1]=${!ref}${COMP_WORDS[i]}'
++ words[1]=je
+ line=
+ [[ 1 == 1 ]]
+ eval cword=1
++ cword=1
+ (( i++, j++ ))
+ (( i < 2 ))
+ local i cur cur2 index=7 'lead=echo je'
+ [[ 7 -gt 0 ]]
+ [[ -n echo je ]]
+ [[ -n echoje ]]
+ cur='echo je'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 7 -ge 4 ]]
+ [[ echo != \e\c\h\o ]]
+ [[ 0 -lt 1 ]]
+ local old_size=7
+ cur=' je'
+ local new_size=3
+ index=3
+ (( ++i ))
+ (( i <= cword ))
+ [[ 3 -ge 2 ]]
+ [[ j != \j\e ]]
+ cur=je
+ (( index-- ))
+ [[ 2 -ge 2 ]]
+ [[ je != \j\e ]]
+ [[ 1 -lt 1 ]]
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n je ]]
+ [[ ! -n je ]]
+ [[ 2 -lt 0 ]]
+ local words cword cur
+ _upvars -a2 words echo je -v cword 1 -v cur je
+ (( 10 ))
+ (( 10 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 6 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 3 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=je
+ shift 3
+ (( 0 ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -n cword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -n prev ]]
+ [[ 1 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -n words ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords "${words[@]}")
+ (( 4 ))
+ local cur cword prev words
+ _upvars -v cur je -v cword 1 -v prev echo -a2 words echo je
+ (( 13 ))
+ (( 13 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=je
+ shift 3
+ (( 10 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 7 ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
++ prev=echo
+ shift 3
+ (( 4 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 0 ))
+ [[ je =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]
+ [[ je == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ echo == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i=1 ))
+ (( i < 2 ))
+ [[ je == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=2
+ (( 1 ))
+ (( i < 2 ))
+ [[ 1 -eq 0 ]]
+ prev=echo
+ [[ -n false ]]
+ _split_longopt
+ [[ je == --?*=* ]]
+ return 1
+ return 0
+ false
+ _filedir
+ local i 'IFS=
' xspec
+ _tilde je
+ local result=0
+ [[ je == ~* ]]
+ return 0
+ local -a toks
+ local quoted tmp
+ _quote_readline_by_ref je quoted
+ [[ j == \' ]]
+ printf -v quoted %q je
+ [[ j == \$ ]]
+ toks=($(
compgen -d -- "$quoted" | {
while read -r tmp; do
# TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
# and everything works again. If this bug suddenly
# appears again (i.e. "cd /b<TAB>" becomes "cd /"),
# remember to check for other similar conditionals (here
# and _filedir_xspec()). --David
printf '%s\n' $tmp
done
}
))
++ compgen -d -- je
++ read -r tmp
+ [[ '' != -d ]]
+ xspec=
+ toks+=($( compgen -f -X "$xspec" -- $quoted ))
++ compgen -f -X '' -- je
+ [[ -n '' ]]
+ '[' 1 -ne 0 ']'
+ compopt -o filenames
+ COMPREPLY+=("${toks[@]}")
e\ jee.txt j+ local cur prev words cword split
+ _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=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '=<>&' cur prev words cword
+ 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_at_cursor_by_ref '=<>&' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '=<>&' words cword
+ local exclude i j line ref
+ [[ -n =<>& ]]
+ exclude='=<>&'
+ eval cword=2
++ cword=2
+ [[ -n =<>& ]]
+ line='echo jee\ jee.txt j'
+ (( i=0, j=0 ))
+ (( i < 3 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ eval 'words[0]=${!ref}${COMP_WORDS[i]}'
++ words[0]=echo
+ line=' jee\ jee.txt j'
+ [[ 0 == 2 ]]
+ (( i++, j++ ))
+ (( i < 3 ))
+ [[ 1 -gt 0 ]]
+ [[ -n jee\ jee.txt ]]
+ [[ '' == jee\ jee.txt ]]
+ ref='words[1]'
+ eval 'words[1]=${!ref}${COMP_WORDS[i]}'
++ words[1]='jee\ jee.txt'
+ line=' j'
+ [[ 1 == 2 ]]
+ (( i++, j++ ))
+ (( i < 3 ))
+ [[ 2 -gt 0 ]]
+ [[ -n j ]]
+ [[ '' == j ]]
+ ref='words[2]'
+ eval 'words[2]=${!ref}${COMP_WORDS[i]}'
++ words[2]=j
+ line=
+ [[ 2 == 2 ]]
+ eval cword=2
++ cword=2
+ (( i++, j++ ))
+ (( i < 3 ))
+ local i cur cur2 index=19 'lead=echo jee\ jee.txt j'
+ [[ 19 -gt 0 ]]
+ [[ -n echo jee\ jee.txt j ]]
+ [[ -n echojee\jee.txtj ]]
+ cur='echo jee\ jee.txt j'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 19 -ge 4 ]]
+ [[ echo != \e\c\h\o ]]
+ [[ 0 -lt 2 ]]
+ local old_size=19
+ cur=' jee\ jee.txt j'
+ local new_size=15
+ index=15
+ (( ++i ))
+ (( i <= cword ))
+ [[ 15 -ge 12 ]]
+ [[ jee\ jee.tx != \j\e\e\\\ \j\e\e\.\t\x\t ]]
+ cur='jee\ jee.txt j'
+ (( index-- ))
+ [[ 14 -ge 12 ]]
+ [[ jee\ jee.txt != \j\e\e\\\ \j\e\e\.\t\x\t ]]
+ [[ 1 -lt 2 ]]
+ local old_size=14
+ cur='jee\ jee.txt j'
+ local new_size=14
+ index=14
+ (( ++i ))
+ (( i <= cword ))
+ [[ 14 -ge 1 ]]
+ [[ j != \j ]]
+ [[ 2 -lt 2 ]]
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n jee\ jee.txt j ]]
+ [[ ! -n jee\jee.txtj ]]
+ [[ 14 -lt 0 ]]
+ local words cword cur
+ _upvars -a3 words echo 'jee\ jee.txt' j -v cword 2 -v cur 'jee\ jee.txt j'
+ (( 11 ))
+ (( 11 ))
+ case $1 in
+ [[ -n 3 ]]
+ printf %d 3
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:3}")'
++ 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='jee\ jee.txt j'
+ shift 3
+ (( 0 ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -n cword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -n prev ]]
+ [[ 2 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -n words ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords "${words[@]}")
+ (( 4 ))
+ local cur cword prev words
+ _upvars -v cur 'jee\ jee.txt j' -v cword 2 -v prev 'jee\ jee.txt' -a3 words echo 'jee\ jee.txt' j
+ (( 14 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur='jee\ jee.txt j'
+ shift 3
+ (( 11 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=2
+ shift 3
+ (( 8 ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
++ prev='jee\ jee.txt'
+ shift 3
+ (( 5 ))
+ case $1 in
+ [[ -n 3 ]]
+ printf %d 3
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:3}")'
++ words=("${@:3:3}")
+ shift 5
+ (( 0 ))
+ [[ jee\ jee.txt j =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]
+ [[ jee\ jee.txt j == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ jee\ jee.txt == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i=1 ))
+ (( i < 3 ))
+ [[ jee\ jee.txt == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=2
+ (( 1 ))
+ (( i < 3 ))
+ [[ j == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=3
+ (( 1 ))
+ (( i < 3 ))
+ [[ 2 -eq 0 ]]
+ prev='jee\ jee.txt'
+ [[ -n false ]]
+ _split_longopt
+ [[ jee\ jee.txt j == --?*=* ]]
+ return 1
+ return 0
+ false
+ _filedir
+ local i 'IFS=
' xspec
+ _tilde 'jee\ jee.txt j'
+ local result=0
+ [[ jee\ jee.txt j == ~* ]]
+ return 0
+ local -a toks
+ local quoted tmp
+ _quote_readline_by_ref 'jee\ jee.txt j' quoted
+ [[ j == \' ]]
+ printf -v quoted %q 'jee\ jee.txt j'
+ [[ j == \$ ]]
+ toks=($(
compgen -d -- "$quoted" | {
while read -r tmp; do
# TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
# and everything works again. If this bug suddenly
# appears again (i.e. "cd /b<TAB>" becomes "cd /"),
# remember to check for other similar conditionals (here
# and _filedir_xspec()). --David
printf '%s\n' $tmp
done
}
))
++ compgen -d -- 'jee\\\ jee.txt\ j'
++ read -r tmp
+ [[ '' != -d ]]
+ xspec=
+ toks+=($( compgen -f -X "$xspec" -- $quoted ))
++ compgen -f -X '' -- 'jee\\\ jee.txt\ j'
+ [[ -n '' ]]
+ '[' 0 -ne 0 ']'
+ COMPREPLY+=("${toks[@]}")
+ local cur prev words cword split
+ _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=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '=<>&' cur prev words cword
+ 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_at_cursor_by_ref '=<>&' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '=<>&' words cword
+ local exclude i j line ref
+ [[ -n =<>& ]]
+ exclude='=<>&'
+ eval cword=2
++ cword=2
+ [[ -n =<>& ]]
+ line='echo jee\ jee.txt j'
+ (( i=0, j=0 ))
+ (( i < 3 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ eval 'words[0]=${!ref}${COMP_WORDS[i]}'
++ words[0]=echo
+ line=' jee\ jee.txt j'
+ [[ 0 == 2 ]]
+ (( i++, j++ ))
+ (( i < 3 ))
+ [[ 1 -gt 0 ]]
+ [[ -n jee\ jee.txt ]]
+ [[ '' == jee\ jee.txt ]]
+ ref='words[1]'
+ eval 'words[1]=${!ref}${COMP_WORDS[i]}'
++ words[1]='jee\ jee.txt'
+ line=' j'
+ [[ 1 == 2 ]]
+ (( i++, j++ ))
+ (( i < 3 ))
+ [[ 2 -gt 0 ]]
+ [[ -n j ]]
+ [[ '' == j ]]
+ ref='words[2]'
+ eval 'words[2]=${!ref}${COMP_WORDS[i]}'
++ words[2]=j
+ line=
+ [[ 2 == 2 ]]
+ eval cword=2
++ cword=2
+ (( i++, j++ ))
+ (( i < 3 ))
+ local i cur cur2 index=19 'lead=echo jee\ jee.txt j'
+ [[ 19 -gt 0 ]]
+ [[ -n echo jee\ jee.txt j ]]
+ [[ -n echojee\jee.txtj ]]
+ cur='echo jee\ jee.txt j'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 19 -ge 4 ]]
+ [[ echo != \e\c\h\o ]]
+ [[ 0 -lt 2 ]]
+ local old_size=19
+ cur=' jee\ jee.txt j'
+ local new_size=15
+ index=15
+ (( ++i ))
+ (( i <= cword ))
+ [[ 15 -ge 12 ]]
+ [[ jee\ jee.tx != \j\e\e\\\ \j\e\e\.\t\x\t ]]
+ cur='jee\ jee.txt j'
+ (( index-- ))
+ [[ 14 -ge 12 ]]
+ [[ jee\ jee.txt != \j\e\e\\\ \j\e\e\.\t\x\t ]]
+ [[ 1 -lt 2 ]]
+ local old_size=14
+ cur='jee\ jee.txt j'
+ local new_size=14
+ index=14
+ (( ++i ))
+ (( i <= cword ))
+ [[ 14 -ge 1 ]]
+ [[ j != \j ]]
+ [[ 2 -lt 2 ]]
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n jee\ jee.txt j ]]
+ [[ ! -n jee\jee.txtj ]]
+ [[ 14 -lt 0 ]]
+ local words cword cur
+ _upvars -a3 words echo 'jee\ jee.txt' j -v cword 2 -v cur 'jee\ jee.txt j'
+ (( 11 ))
+ (( 11 ))
+ case $1 in
+ [[ -n 3 ]]
+ printf %d 3
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:3}")'
++ 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='jee\ jee.txt j'
+ shift 3
+ (( 0 ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -n cword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -n prev ]]
+ [[ 2 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -n words ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords "${words[@]}")
+ (( 4 ))
+ local cur cword prev words
+ _upvars -v cur 'jee\ jee.txt j' -v cword 2 -v prev 'jee\ jee.txt' -a3 words echo 'jee\ jee.txt' j
+ (( 14 ))
+ (( 14 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur='jee\ jee.txt j'
+ shift 3
+ (( 11 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=2
+ shift 3
+ (( 8 ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
++ prev='jee\ jee.txt'
+ shift 3
+ (( 5 ))
+ case $1 in
+ [[ -n 3 ]]
+ printf %d 3
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:3}")'
++ words=("${@:3:3}")
+ shift 5
+ (( 0 ))
+ [[ jee\ jee.txt j =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]
+ [[ jee\ jee.txt j == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ jee\ jee.txt == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i=1 ))
+ (( i < 3 ))
+ [[ jee\ jee.txt == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=2
+ (( 1 ))
+ (( i < 3 ))
+ [[ j == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=3
+ (( 1 ))
+ (( i < 3 ))
+ [[ 2 -eq 0 ]]
+ prev='jee\ jee.txt'
+ [[ -n false ]]
+ _split_longopt
+ [[ jee\ jee.txt j == --?*=* ]]
+ return 1
+ return 0
+ false
+ _filedir
+ local i 'IFS=
' xspec
+ _tilde 'jee\ jee.txt j'
+ local result=0
+ [[ jee\ jee.txt j == ~* ]]
+ return 0
+ local -a toks
+ local quoted tmp
+ _quote_readline_by_ref 'jee\ jee.txt j' quoted
+ [[ j == \' ]]
+ printf -v quoted %q 'jee\ jee.txt j'
+ [[ j == \$ ]]
+ toks=($(
compgen -d -- "$quoted" | {
while read -r tmp; do
# TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
# and everything works again. If this bug suddenly
# appears again (i.e. "cd /b<TAB>" becomes "cd /"),
# remember to check for other similar conditionals (here
# and _filedir_xspec()). --David
printf '%s\n' $tmp
done
}
))
++ compgen -d -- 'jee\\\ jee.txt\ j'
++ compgen -d -- 'jee\\\ jee.txt\ j'
++ read -r tmp
+ [[ '' != -d ]]
+ xspec=
+ toks+=($( compgen -f -X "$xspec" -- $quoted ))
++ compgen -f -X '' -- 'jee\\\ jee.txt\ j'
+ [[ -n '' ]]
+ '[' 0 -ne 0 ']'
+ COMPREPLY+=("${toks[@]}")
+ echo 'jee jee.txt' j
jee jee.txt j
++ printf '\033]0;%s@%s:%s\007' safari safari '~/comp'
I still can't reproduce, that works fine for me too. What files are in your working dir when invoking this command? What's in /etc/bash_completion.d? Also try in a clean environment: $ bash --norc $ . /usr/share/bash-completion/bash_completion # then invoke completions in cwd I have
-rw-r--r-- 1 safari xuser 0 2011-12-31 19:10:56.233405162 +0200 foo.txt
-rw-r--r-- 1 safari xuser 0 2011-12-31 19:10:56.233405162 +0200 jee jee.txt
I tried the following test with only redefine_filedir in /etc/bash_completion.d
but it still does not work.
bash-4.2$ echo jee+ local cur prev words cword split
+ _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=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '=<>&' cur prev words cword
+ 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_at_cursor_by_ref '=<>&' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '=<>&' words cword
+ local exclude i j line ref
+ [[ -n =<>& ]]
+ exclude='=<>&'
+ eval cword=1
++ cword=1
+ [[ -n =<>& ]]
+ line='echo jee'
+ (( i=0, j=0 ))
+ (( i < 2 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ eval 'words[0]=${!ref}${COMP_WORDS[i]}'
++ words[0]=echo
+ line=' jee'
+ [[ 0 == 1 ]]
+ (( i++, j++ ))
+ (( i < 2 ))
+ [[ 1 -gt 0 ]]
+ [[ -n jee ]]
+ [[ '' == jee ]]
+ ref='words[1]'
+ eval 'words[1]=${!ref}${COMP_WORDS[i]}'
++ words[1]=jee
+ line=
+ [[ 1 == 1 ]]
+ eval cword=1
++ cword=1
+ (( i++, j++ ))
+ (( i < 2 ))
+ local i cur cur2 index=8 'lead=echo jee'
+ [[ 8 -gt 0 ]]
+ [[ -n echo jee ]]
+ [[ -n echojee ]]
+ cur='echo jee'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 8 -ge 4 ]]
+ [[ echo != \e\c\h\o ]]
+ [[ 0 -lt 1 ]]
+ local old_size=8
+ cur=' jee'
+ local new_size=4
+ index=4
+ (( ++i ))
+ (( i <= cword ))
+ [[ 4 -ge 3 ]]
+ [[ je != \j\e\e ]]
+ cur=jee
+ (( index-- ))
+ [[ 3 -ge 3 ]]
+ [[ jee != \j\e\e ]]
+ [[ 1 -lt 1 ]]
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n jee ]]
+ [[ ! -n jee ]]
+ [[ 3 -lt 0 ]]
+ local words cword cur
+ _upvars -a2 words echo jee -v cword 1 -v cur jee
+ (( 10 ))
+ (( 10 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 6 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 3 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=jee
+ shift 3
+ (( 0 ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -n cword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -n prev ]]
+ [[ 1 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -n words ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords "${words[@]}")
+ (( 4 ))
+ local cur cword prev words
+ _upvars -v cur jee -v cword 1 -v prev echo -a2 words echo jee
+ (( 13 ))
+ (( 13 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur=jee
+ shift 3
+ (( 10 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=1
+ shift 3
+ (( 7 ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
++ prev=echo
+ shift 3
+ (( 4 ))
+ case $1 in
+ [[ -n 2 ]]
+ printf %d 2
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:2}")'
++ words=("${@:3:2}")
+ shift 4
+ (( 0 ))
+ [[ jee =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]
+ [[ jee == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ echo == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i=1 ))
+ (( i < 2 ))
+ [[ jee == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=2
+ (( 1 ))
+ (( i < 2 ))
+ [[ 1 -eq 0 ]]
+ prev=echo
+ [[ -n false ]]
+ _split_longopt
+ [[ jee == --?*=* ]]
+ return 1
+ return 0
+ false
+ _filedir
+ local i 'IFS=
' xspec
+ _tilde jee
+ local result=0
+ [[ jee == ~* ]]
+ return 0
+ local -a toks
+ local quoted tmp
+ _quote_readline_by_ref jee quoted
+ [[ j == \' ]]
+ printf -v quoted %q jee
+ [[ j == \$ ]]
+ toks=($(
compgen -d -- "$quoted" | {
while read -r tmp; do
# TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
# and everything works again. If this bug suddenly
# appears again (i.e. "cd /b<TAB>" becomes "cd /"),
# remember to check for other similar conditionals (here
# and _filedir_xspec()). --David
printf '%s\n' $tmp
done
}
))
++ compgen -d -- jee
++ read -r tmp
+ [[ '' != -d ]]
+ xspec=
+ toks+=($( compgen -f -X "$xspec" -- $quoted ))
++ compgen -f -X '' -- jee
+ [[ -n '' ]]
+ '[' 1 -ne 0 ']'
+ compopt -o filenames
+ COMPREPLY+=("${toks[@]}")
\ jee.txt jee+ local cur prev words cword split
+ _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=@(?([0-9])<|?([0-9&])>?(>)|>&)'
+ _get_comp_words_by_ref -n '=<>&' cur prev words cword
+ 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_at_cursor_by_ref '=<>&' words cword cur
+ words=()
+ local cword words
+ __reassemble_comp_words_by_ref '=<>&' words cword
+ local exclude i j line ref
+ [[ -n =<>& ]]
+ exclude='=<>&'
+ eval cword=2
++ cword=2
+ [[ -n =<>& ]]
+ line='echo jee\ jee.txt jee'
+ (( i=0, j=0 ))
+ (( i < 3 ))
+ [[ 0 -gt 0 ]]
+ ref='words[0]'
+ eval 'words[0]=${!ref}${COMP_WORDS[i]}'
++ words[0]=echo
+ line=' jee\ jee.txt jee'
+ [[ 0 == 2 ]]
+ (( i++, j++ ))
+ (( i < 3 ))
+ [[ 1 -gt 0 ]]
+ [[ -n jee\ jee.txt ]]
+ [[ '' == jee\ jee.txt ]]
+ ref='words[1]'
+ eval 'words[1]=${!ref}${COMP_WORDS[i]}'
++ words[1]='jee\ jee.txt'
+ line=' jee'
+ [[ 1 == 2 ]]
+ (( i++, j++ ))
+ (( i < 3 ))
+ [[ 2 -gt 0 ]]
+ [[ -n jee ]]
+ [[ '' == jee ]]
+ ref='words[2]'
+ eval 'words[2]=${!ref}${COMP_WORDS[i]}'
++ words[2]=jee
+ line=
+ [[ 2 == 2 ]]
+ eval cword=2
++ cword=2
+ (( i++, j++ ))
+ (( i < 3 ))
+ local i cur cur2 index=21 'lead=echo jee\ jee.txt jee'
+ [[ 21 -gt 0 ]]
+ [[ -n echo jee\ jee.txt jee ]]
+ [[ -n echojee\jee.txtjee ]]
+ cur='echo jee\ jee.txt jee'
+ (( i = 0 ))
+ (( i <= cword ))
+ [[ 21 -ge 4 ]]
+ [[ echo != \e\c\h\o ]]
+ [[ 0 -lt 2 ]]
+ local old_size=21
+ cur=' jee\ jee.txt jee'
+ local new_size=17
+ index=17
+ (( ++i ))
+ (( i <= cword ))
+ [[ 17 -ge 12 ]]
+ [[ jee\ jee.tx != \j\e\e\\\ \j\e\e\.\t\x\t ]]
+ cur='jee\ jee.txt jee'
+ (( index-- ))
+ [[ 16 -ge 12 ]]
+ [[ jee\ jee.txt != \j\e\e\\\ \j\e\e\.\t\x\t ]]
+ [[ 1 -lt 2 ]]
+ local old_size=16
+ cur='jee\ jee.txt jee'
+ local new_size=16
+ index=16
+ (( ++i ))
+ (( i <= cword ))
+ [[ 16 -ge 3 ]]
+ [[ jee != \j\e\e ]]
+ [[ 2 -lt 2 ]]
+ (( ++i ))
+ (( i <= cword ))
+ [[ -n jee\ jee.txt jee ]]
+ [[ ! -n jee\jee.txtjee ]]
+ [[ 16 -lt 0 ]]
+ local words cword cur
+ _upvars -a3 words echo 'jee\ jee.txt' jee -v cword 2 -v cur 'jee\ jee.txt jee'
+ (( 11 ))
+ (( 11 ))
+ case $1 in
+ [[ -n 3 ]]
+ printf %d 3
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:3}")'
++ 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='jee\ jee.txt jee'
+ shift 3
+ (( 0 ))
+ [[ -n cur ]]
+ upvars+=("$vcur")
+ upargs+=(-v $vcur "$cur")
+ [[ -n cword ]]
+ upvars+=("$vcword")
+ upargs+=(-v $vcword "$cword")
+ [[ -n prev ]]
+ [[ 2 -ge 1 ]]
+ upvars+=("$vprev")
+ upargs+=(-v $vprev "${words[cword - 1]}")
+ [[ -n words ]]
+ upvars+=("$vwords")
+ upargs+=(-a${#words[@]} $vwords "${words[@]}")
+ (( 4 ))
+ local cur cword prev words
+ _upvars -v cur 'jee\ jee.txt jee' -v cword 2 -v prev 'jee\ jee.txt' -a3 words echo 'jee\ jee.txt' jee
+ (( 14 ))
+ (( 14 ))
+ case $1 in
+ [[ -n cur ]]
+ unset -v cur
+ eval 'cur="$3"'
++ cur='jee\ jee.txt jee'
+ shift 3
+ (( 11 ))
+ case $1 in
+ [[ -n cword ]]
+ unset -v cword
+ eval 'cword="$3"'
++ cword=2
+ shift 3
+ (( 8 ))
+ case $1 in
+ [[ -n prev ]]
+ unset -v prev
+ eval 'prev="$3"'
++ prev='jee\ jee.txt'
+ shift 3
+ (( 5 ))
+ case $1 in
+ [[ -n 3 ]]
+ printf %d 3
+ [[ -n words ]]
+ unset -v words
+ eval 'words=("${@:3:3}")'
++ words=("${@:3:3}")
+ shift 5
+ (( 0 ))
+ [[ jee\ jee.txt jee =~ ^(\$\{?)([A-Za-z0-9_]*)$ ]]
+ [[ jee\ jee.txt jee == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ jee\ jee.txt == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
+ local i skip
+ (( i=1 ))
+ (( i < 3 ))
+ [[ jee\ jee.txt == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=2
+ (( 1 ))
+ (( i < 3 ))
+ [[ jee == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ i=3
+ (( 1 ))
+ (( i < 3 ))
+ [[ 2 -eq 0 ]]
+ prev='jee\ jee.txt'
+ [[ -n false ]]
+ _split_longopt
+ [[ jee\ jee.txt jee == --?*=* ]]
+ return 1
+ return 0
+ false
+ _filedir
+ local i 'IFS=
' xspec
+ _tilde 'jee\ jee.txt jee'
+ local result=0
+ [[ jee\ jee.txt jee == ~* ]]
+ return 0
+ local -a toks
+ local quoted tmp
+ _quote_readline_by_ref 'jee\ jee.txt jee' quoted
+ [[ j == \' ]]
+ printf -v quoted %q 'jee\ jee.txt jee'
+ [[ j == \$ ]]
+ toks=($(
compgen -d -- "$quoted" | {
while read -r tmp; do
# TODO: I have removed a "[ -n $tmp ] &&" before 'printf ..',
# and everything works again. If this bug suddenly
# appears again (i.e. "cd /b<TAB>" becomes "cd /"),
# remember to check for other similar conditionals (here
# and _filedir_xspec()). --David
printf '%s\n' $tmp
done
}
))
++ compgen -d -- 'jee\\\ jee.txt\ jee'
++ read -r tmp
+ [[ '' != -d ]]
+ xspec=
+ toks+=($( compgen -f -X "$xspec" -- $quoted ))
++ compgen -f -X '' -- 'jee\\\ jee.txt\ jee'
+ [[ -n '' ]]
+ '[' 0 -ne 0 ']'
+ COMPREPLY+=("${toks[@]}")
+ echo 'jee jee.txt' jee
jee jee.txt jee
bash-4.2$ exit
Oops, I was testing with the upstream git version, not 1.90. Now managed to reproduce; this is already fixed upstream and will be included in the next release: http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=commitdiff;h=b3fcb55 |
Description of problem: if dir has files "foo.txt" and "jee jee.txt", when entering command mv jee[tab][tab][tab] bash does not show the files in the directory. bash however completes jee[tab] to "jee\ jee.txt", so it is not 100% broken. bash starts working when I type command mv /etc/profile.d/bash_completion.sh{,it} and restarting xterm/logging in again/etc Version-Release number of selected component (if applicable): 1.90-1 How reproducible: 100% Steps to Reproduce: 1. touch foo.txt jee\ jee.txt 2. do as described earlier Actual results: filename completion does not work Expected results: working filename completion Additional info: