Here are attached the traces resulting of completing 'ls ../fooe/<TAB>'
(out.ok), and 'ls ../fooé/<TAB>' (out.nok).

Comparing their output shows an issue with line 415 of bash_completion
file, in second test:
elif [[ "${#words[cword]}" -eq 0 ]] || [[ "$COMP_POINT" ==
"${#COMP_LINE}" ]];

With pure ascii, $COMP_POINT = ${#COMP_LINE} = 11, meaning the test is
true, but with non ascii chars, $COMP_POINT = 13 and ${#COMP_LINE} = 12,
meaning the test is false. It seems like an utf8 issue, with bash (or
readline) miscouting string with multibytes characters length.

I'm using bash 4.1 and readline 6.1, with all upstream patches applied,
including this one, which appeared related at first glance:
http://ftp.gnu.org/gnu/bash/bash-4.1-patches/bash41-002
-- 
BOFH excuse #314:

You need to upgrade your VESA local bus to a MasterCard local bus.
++ _get_cword
++ local cword words
++ __reassemble_comp_words_by_ref '' words cword
++ local exclude i j ref
++ [[ -n '' ]]
++ eval cword=1
+++ cword=1
++ [[ -n '' ]]
++ eval 'words=(' '"${comp_wor...@]}"' ')'
+++ words=("${comp_wor...@]}")
++ [[ -n '' ]]
++ [[ 8 -eq 0 ]]
++ [[ 11 == \1\1 ]]
++ printf %s ../fooe/
+ cur=../fooe/
+ prev=ls
+ _split_longopt
+ [[ ../fooe/ == --?*=* ]]
+ return 1
+ [[ ../fooe/ == -* ]]
+ [[ ls == rmdir ]]
+ _filedir
+ local i 'IFS= 
' xspec
+ __expand_tilde_by_ref cur
+ '[' . = '~' ']'
+ local -a toks
+ local quoted tmp
+ _quote_readline_by_ref ../fooe/ quoted
+ [[ . == \' ]]
+ [[ 4 -le 3 ]]
+ printf -v quoted %q ../fooe/
+ toks=(${to...@]-} $(
        compgen -d -- "$quoted" | {
            while read -r tmp; do
                printf '%s\n' $tmp
            done
        }
    ))
++ compgen -d -- ../fooe/
++ read -r tmp
+ [[ '' != -d ]]
+ xspec=
+ [[ . == \' ]]
+ toks=(${to...@]-} $(
                compgen -f -X "$xspec" -- $quoted
            ))
++ compgen -f -X '' -- ../fooe/
+ '[' 0 -ne 0 ']'
+ COMPREPLY=("${comprep...@]}" "${to...@]}")
++ _get_cword
++ local cword words
++ __reassemble_comp_words_by_ref '' words cword
++ local exclude i j ref
++ [[ -n '' ]]
++ eval cword=1
+++ cword=1
++ [[ -n '' ]]
++ eval 'words=(' '"${comp_wor...@]}"' ')'
+++ words=("${comp_wor...@]}")
++ [[ -n '' ]]
++ [[ 8 -eq 0 ]]
++ [[ 13 == \1\2 ]]
++ local i
++ local 'cur= ls ../fooé/'
++ local index=13
++ (( i = 0 ))
++ (( i <= cword ))
++ [[ 12 -ge 2 ]]
++ [[  l != \l\s ]]
++ cur='ls ../fooé/'
++ (( index-- ))
++ [[ 11 -ge 2 ]]
++ [[ ls != \l\s ]]
++ [[ 0 -lt 1 ]]
++ local old_size=11
++ cur=' ../fooé/'
++ local new_size=9
++ index=10
++ (( ++i  ))
++ (( i <= cword ))
++ [[ 9 -ge 8 ]]
++ [[  ../fooé != \.\.\/\f\o\o\é\/ ]]
++ cur=$'../foo\303\251/'
++ (( index-- ))
++ [[ 8 -ge 8 ]]
++ [[ ../fooé/ != \.\.\/\f\o\o\é\/ ]]
++ [[ 1 -lt 1 ]]
++ (( ++i  ))
++ (( i <= cword ))
++ [[ ../fooé/ != \.\.\/\f\o\o\é\/ ]]
++ printf %s $'../foo\303\251/'
+ cur=$'../foo\303\251/'
+ prev=ls
+ _split_longopt
+ [[ ../fooé/ == --?*=* ]]
+ return 1
+ [[ ../fooé/ == -* ]]
+ [[ ls == rmdir ]]
+ _filedir
+ local i 'IFS= 
' xspec
+ __expand_tilde_by_ref cur
+ '[' . = '~' ']'
+ local -a toks
+ local quoted tmp
+ _quote_readline_by_ref $'../foo\303\251/' quoted
+ [[ . == \' ]]
+ [[ 4 -le 3 ]]
+ printf -v quoted %q $'../foo\303\251/'
+ toks=(${to...@]-} $(
        compgen -d -- "$quoted" | {
            while read -r tmp; do
                printf '%s\n' $tmp
            done
        }
    ))
++ compgen -d -- '$'\''../foo\303\251/'\'''
++ read -r tmp
+ [[ '' != -d ]]
+ xspec=
+ [[ . == \' ]]
+ toks=(${to...@]-} $(
                compgen -f -X "$xspec" -- $quoted
            ))
++ compgen -f -X '' -- '$'\''../foo\303\251/'\'''
+ '[' 0 -ne 0 ']'
+ COMPREPLY=("${comprep...@]}" "${to...@]}")
_______________________________________________
Bash-completion-devel mailing list
Bash-completion-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel

Reply via email to