python tab-completion error: bash: COMP_WORDS: bad array subscript

Bug #745767 reported by Marius Gedminas on 2011-03-30
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)

Bug Description

Binary package hint: bash-completion

When I'm specifying the full path to a Python interpreter (which is very common for Python developers who use zc.buildout or virtualenv), attempting tab-completion of the first argument results in errors.

To reproduce:
  1. touch python
  2. chmod +x python
  3. type ./python scri<tab>

Expected output:

Actual output:
  ./python scribash: COMP_WORDS: bad array subscript

The bug is in /etc/bash_completion.d/python, line 26. If I replace

        [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir


        [[ $COMP_CWORD -ge 2 ]] && [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir

then completion works without emitting spurious errors.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: bash-completion 1:1.2-2ubuntu1.1
ProcVersionSignature: Ubuntu 2.6.35-28.50-generic
Uname: Linux 2.6.35-28-generic i686
Architecture: i386
Date: Wed Mar 30 17:55:42 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
PackageArchitecture: all
 PATH=(custom, user)
SourcePackage: bash-completion

Marius Gedminas (mgedmin) wrote :
Marius Gedminas (mgedmin) wrote :

This appears to be fixed in bash-completion 1:1.3-1ubuntu3 from natty.

Changed in bash-completion (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers