./python completion problems

Bug #660613 reported by Barry Warsaw
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: bash-completion

Get a source checkout of Python:

bzr branch lp:python
cd python
./configure && make
./python Lib/test[TAB]

The following error occurs at the TAB

% ./python Lib/testbash: COMP_WORDS: bad array subscript

Revision history for this message
Jacob Wan (wildlemur) wrote :

I noticed this problem too. One bit of information to add: it seems to only happen when the python executable is being invoked via a symbolic link. For example, if I want to run the script app.py in the current directory, "/usr/bin/python a<TAB>" causes the error, while "/usr/bin/python2.6 a<TAB>" does not. In either case, the correct thing ultimately happens, but the symlink version inserts the "COMP_WORDS: bad array subscript" message.

Revision history for this message
Michael Foord (mfoord) wrote :

I have this problem when trying to use bash completion with a buildout python.

The following is sufficient to trigger it:

    bin/python <tab>

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in bash-completion (Ubuntu):
status: New → Confirmed
Revision history for this message
Nicolas Krzywinski (nsk7even) wrote :

I just encountered this on my server, which is debian with bash 4.1.5(1)-release, python 2.6.6 and kernel 2.6.32-5-amd64

But it works with calling the python cmd only:
python /etc/ba<TAB>sh_completion.d/

Exploit:
/usr/bin/python /etc/ba<TAB>-bash: COMP_WORDS: Falscher Feldbezeichner.
sh

Notice: it does not matter what the path is

Since this is the only bug I found for this (german spelled) error message, I am posting here, though I encountered it NOT on Ubuntu, but Debian.

Revision history for this message
Peter Cordes (peter-cordes) wrote :

Can anyone else confirm that /usr/bin/python /etc/ba<TAB> is a valid testcase for this? Or is ln -s /usr/bin/python tmp/python needed?

 I'm not seeing a problem on trusty with Nicolas's testcase, but I don't have anything special with python source lying around.

Changed in bash-completion (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Peter Cordes (peter-cordes) wrote :

There's something fishy going on,

/usr/bin/python /etc/ba[TAB] => prints a single completion, but doesn't apply it.
bash_completion.d/

python /etc/ba[TAB] => /etc/bash_completion.d/

 I think when testing this before, I had my completion dynamic loading messed up, and wasn't getting /usr/share/bash-completion/completions/python

Turns out keeping an unmodified copy of what Ubuntu ships isn't enough, you need a symlink to /usr/share/bash-completion/completions in the directory with it, because it cares about where it lives. Checking other bugs I closed recently in case I tested improperly... xD

summary: - COMP_WORDS bad array subscript in python completion
+ ./python completion problems
Changed in bash-completion (Ubuntu):
status: Incomplete → Confirmed
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.