[Bash-completion-devel] [bash-completion-Bugs][311842] error message when completing before a pipe

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Wed Jul 22 21:20:45 UTC 2009


Bugs item #311842, was changed at 2009-07-22 07:00 by Ville Skyttä 
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=311842&group_id=100114

Status: Open
Priority: 3
Submitted By: Ildar Mulyukov (ildar-guest)
Assigned to: Nobody (None)
Summary: error message when completing before a pipe 
Distribution: None
Originally reported in: None
Milestone: None
Status: None
Original bug number: 


Initial Comment:
http://bugzilla.altlinux.org/16016 originally

Описание от  Ivan Zakharyaschev   2008-06-13 23:37:17   (-) [ответить]

bash-completion-20060301-alt05
bash-3.2.39-alt1

$ mkdir bash-compl
$ cd bash-compl/
$ touch a
#Type "cat  | cat", go to the 5th position (after first "cat", between two
spaces) and press TAB:
$ cat bash: COMP_WORDS: bad array subscript
a



----------------------------------------------------------------------

>Comment By: Ville Skyttä  (scop-guest)
Date: 2009-07-23 00:20

Message:
bash bug report/inquiry: http://thread.gmane.org/gmane.comp.shells.bash.bugs/13226

----------------------------------------------------------------------

Comment By: Ville Skyttä  (scop-guest)
Date: 2009-07-22 23:40

Message:
It doesn't even seem to need the pipe, just typing "cat  " (two spaces), going back to the position between the two spaces and hitting tab.

But then again, this could also be a bash bug, try this without bash-completion:

    foo()
    {
        echo ""
        echo "COMP_CWORD:$COMP_CWORD"
        echo ">${COMP_WORDS[COMP_CWORD]}"
    }
    complete -F foo foo

Then, type "foo  ", go between the two spaces and hit tab, here's what I see with bash 3.00.15(1)-release, 3.2.39(1)-release, 4.0.16(1)-release and 4.0.24(1)-release:

COMP_CWORD:-2
bash: COMP_WORDS: bad array subscript
>

So I suppose this ends up using -2 as the COMP_WORDS array index and that's a problem.  I don't see any documentation regarding possibly negative COMP_CWORD values and negative array indexes don't seem to be supported in bash in the first place either.

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=311842&group_id=100114



More information about the Bash-completion-devel mailing list