[Bash-completion-devel] Bug#622383: bash-completion: completion only works from left to right: error : bash: $index: substring expression < 0

David Paleino dapal at debian.org
Tue Apr 12 18:33:41 UTC 2011


tags 622383 = confirmed upstream
thanks

On Tue, 12 Apr 2011 19:43:02 +0200, Alban Browaeys wrote:

> Le mardi 12 avril 2011 à 19:16 +0200, David Paleino a écrit :
> > I can't reproduce this (| is where I place the cursor, and hit TAB):
> > 
> > $ ls a|
> > acpi-path-to-use-sysfs.mdwn  am-assigned.mdwn
> > [..]
> > $ ls |a
> > Display all 110 possibilities? (y or n)
> > ^C
> > $
> 
> Sorry I forgot to tell there need to be a space before and after the
> location where the cursor is:
> $ ls <cursor>  a

Ok, confirming it now, it also happens with the latest git revision.

> $ ls + local cur prev split=false
> + _get_comp_words_by_ref -n = cur prev
> + 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
> + case $flag in
> + exclude==
> + getopts c:i:n:p:w: flag -n = cur prev
> + [[ 4 -ge 3 ]]
> + case ${!OPTIND} in
> + vcur=cur
> + let 'OPTIND += 1'
> + [[ 4 -ge 4 ]]
> + case ${!OPTIND} in
> + vprev=prev
> + let 'OPTIND += 1'
> + [[ 4 -ge 5 ]]
> + __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 = ]]
> + exclude==
> + eval cword=1
> ++ cword=1
> + [[ -n = ]]
> + (( i=0, j=0 ))
> + (( i < 2 ))
> + [[ 0 -gt 0 ]]
> + ref='words[0]'
> + eval 'words[0]=${!ref}${COMP_WORDS[i]}'
> ++ words[0]=ls
> + [[ 0 == 1 ]]
> + (( i++, j++ ))
> + (( i < 2 ))
> + [[ 1 -gt 0 ]]
> + [[ -n a ]]
> + [[ '' == a ]]
> + ref='words[1]'
> + eval 'words[1]=${!ref}${COMP_WORDS[i]}'
> ++ words[1]=a
> + [[ 1 == 1 ]]
> + eval cword=1
> ++ cword=1
> + (( i++, j++ ))
> + (( i < 2 ))
> + local i cur2
> + local 'cur=ls  a'
> + local index=3
> + (( i = 0 ))
> + (( i <= cword ))
> + [[ 5 -ge 2 ]]
> + [[ ls != \l\s ]]
> + [[ 0 -lt 1 ]]
> + local old_size=5
> + cur='  a'
> + local new_size=3
> + index=1
> + (( ++i  ))
> + (( i <= cword ))
> + [[ 3 -ge 1 ]]
> + [[   != \a ]]
> + cur=' a'
> + (( index-- ))
> + [[ 2 -ge 1 ]]
> + [[   != \a ]]
> + cur=a
> + (( index-- ))
> + [[ 1 -ge 1 ]]
> + [[ a != \a ]]
> + [[ 1 -lt 1 ]]
> + (( ++i  ))
> + (( i <= cword ))
> + [[ a != \a ]]
> bash: $index: substring expression < 0

I'll investigate this, thanks.

Kindly,
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/20110412/17f43cda/attachment.pgp>


More information about the Bash-completion-devel mailing list