[Bash-completion-devel] Bug#630521: Bug#630521: bash-completion: no longer completes files for vi

David Paleino dapal at debian.org
Tue Jun 14 20:03:50 UTC 2011


tags 630521 = confirmed upstream
retitle 630521 files starting with '!' break editors file-based completion
thanks

On Tue, 14 Jun 2011 21:53:41 +0200, Michal Suchanek wrote:

> On 14 June 2011 21:22, David Paleino <dapal at debian.org> wrote:
> > On Tue, 14 Jun 2011 21:05:07 +0200, Michal Suchanek wrote:
> >
> >> This is a regression, it used to be possible to complete pretty much any
> >> file. Now only directories are completed for vi, or some very unusual
> >> files I don't have.
> >>
> >> [..]
> >
> > Ugh, I'm thinking about acroread. Do you have its completion
> > in /etc/bash_completion.d/ ? If yes, does removing it fix the bug?
> >
> 
> No, I don't have that file.

Ok.

> Below is the completion output.
> 
> 
> $ ls
> !file  foobar.txt

Aha! It's that "!file" that breaks the completion. I'm confirming the bug now.

> $ vi foo+ local IFS cur xspec
> + IFS='
> '
> + COMPREPLY=()
> + _get_comp_words_by_ref cur
> + 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 cur
> + [[ 1 -ge 1 ]]
> + case ${!OPTIND} in
> + vcur=cur
> + let 'OPTIND += 1'
> + [[ 1 -ge 2 ]]
> + __get_cword_at_cursor_by_ref '' words cword cur
> + words=()
> + 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_WORDS[@]}"' ')'
> ++ words=("${COMP_WORDS[@]}")
> + local i cur2
> + local 'cur=vi foo'
> + local index=6
> + (( i = 0 ))
> + (( i <= cword ))
> + [[ 6 -ge 2 ]]
> + [[ vi != \v\i ]]
> + [[ 0 -lt 1 ]]
> + local old_size=6
> + cur=' foo'
> + local new_size=4
> + index=4
> + (( ++i  ))
> + (( i <= cword ))
> + [[ 4 -ge 3 ]]
> + [[  fo != \f\o\o ]]
> + cur=foo
> + (( index-- ))
> + [[ 3 -ge 3 ]]
> + [[ foo != \f\o\o ]]
> + [[ 1 -lt 1 ]]
> + (( ++i  ))
> + (( i <= cword ))
> + [[ foo != \f\o\o ]]
> + cur2=foo
> + local words cword cur
> + _upvars -a2 words vi foo -v cword 1 -v cur foo
> + ((  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=foo
> + shift 3
> + ((  0  ))
> + [[ -n cur ]]
> + upvars+=("$vcur")
> + upargs+=(-v $vcur "$cur")
> + [[ -n '' ]]
> + [[ -n '' ]]
> + [[ -n '' ]]
> + ((  1  ))
> + local cur
> + _upvars -v cur foo
> + ((  3  ))
> + ((  3  ))
> + case $1 in
> + [[ -n cur ]]
> + unset -v cur
> + eval 'cur="$3"'
> ++ cur=foo
> + shift 3
> + ((  0  ))
> + _expand
> + [[ foo == \~*/* ]]
> + [[ foo == \~* ]]
> ++ awk '/^complete[ \t]+.*[ \t]vi([ \t]|$)/ { print $0; exit }'
> /etc/bash_completion
> + xspec='complete -f -X
> '\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'\''
> vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs
> kate kwrite'
> +
> xspec=''\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'\''
> vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate
> kwrite'
> +
> xspec=''\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'\'''
> + local -a toks
> + local tmp
> + toks=(${toks[@]-} $(
>         compgen -d -- "$(quote_readline "$cur")" | {
>         while read -r tmp; do
>             # see long TODO comment in _filedir() --David
>             printf '%s\n' $tmp
>         done
>         }
>         ))
> ++ read -r tmp
> +++ quote_readline foo
> +++ local quoted
> +++ _quote_readline_by_ref foo ret
> +++ [[ f == \' ]]
> +++ [[ 4 -le 3 ]]
> +++ printf -v ret %q foo
> +++ [[ f == \$ ]]
> +++ printf %s foo
> ++ compgen -d -- foo
> + eval
> 'xspec='\''*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'\'''
> ++
> xspec='*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)'
> + local 'matchop=!'
> + [[ *.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)
> == !* ]]
> + [[ 4 -ge 4 ]]
> +
> xspec='!(*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)|*.@(O|SO|SO.!(CONF)|A|[RS]PM|GIF|JP?(E)G|MP3|MP?(E)G|AVI|ASF|OGG|CLASS))'
> + toks=(${toks[@]-} $(
>         eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | {
>         while read -r tmp; do
>             [ -n $tmp ] && printf '%s\n' $tmp
>         done
>         }
>         ))
> ++ eval compgen -f -X
> '!!(*.@(o|so|so.!(conf)|a|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)|*.@(O|SO|SO.!(CONF)|A|[RS]PM|GIF|JP?(E)G|MP3|MP?(E)G|AVI|ASF|OGG|CLASS))'
> -- '$(quote_readline $cur)'
> ++ read -r tmp
> ++++ quote_readline foo
> ++++ local quoted
> ++++ _quote_readline_by_ref foo ret
> ++++ [[ f == \' ]]
> ++++ [[ 4 -le 3 ]]
> ++++ printf -v ret %q foo
> ++++ [[ f == \$ ]]
> ++++ printf %s foo
> +++ compgen -f -X '!file' -- foo
> + '[' 0 -ne 0 ']'
> + COMPREPLY=("${toks[@]}")


Thanks,
David

-- 
 . ''`.   Debian developer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://deb.li/dapal
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20110614/c38e9526/attachment-0001.pgp>


More information about the Bash-completion-devel mailing list