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

Bug #745767 reported by Marius Gedminas
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Fix Released
Undecided
Unassigned

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 script.py
  2. chmod +x python
  3. type ./python scri<tab>

Expected output:
  ./python script.py

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

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

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

with

        [[ $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 2.6.35.11
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
ProcEnviron:
 LANGUAGE=lt_LT:lt:en_GB:en
 LC_CTYPE=lt_LT.UTF-8
 PATH=(custom, user)
 LANG=lt_LT.utf8
 SHELL=/bin/bash
SourcePackage: bash-completion

Revision history for this message
Marius Gedminas (mgedmin) wrote :
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.