bzr bash completion error (compgen: --: invalid option)

Bug #156299 reported by Marius Gedminas
8
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Wishlist
Unassigned
bzr (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

Binary package hint: bzr

Get a bash shell with /etc/bash_completion sourced. Type "bzr --v". Press Tab. You'll get an error message:

$ bzr --vbash: compgen: --: invalid option
compgen: usage: compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [word]

Revision history for this message
Andrea Corbellini (andrea.corbellini) wrote :

I can confirm this bug on Hardy.

Changed in bzr:
importance: Undecided → Wishlist
status: New → Confirmed
Vincent Ladeuil (vila)
Changed in bzr:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Jan Urbański (wulczer) wrote :

The error message appears because of the following code in contrib/bash/bzr.simple

COMPREPLY=( $( compgen -W "$(_bzr_commands)" $cur ) )

If $cur contains "--v" compgen complains about an unknown --v option. The fix is to insert "--" before the $cur variable.

Another issue with that code is that $cur should be quoted in case it contains special characters that can be misinterpreted by the shell, like spaces.

Note that this problem does not appear in bzr 2.2, because bzr.simple is gone in that version. In bzr 2.1 Debian and Ubuntu packaging both install bzr and bzr.simple into /etc/bash_completion.d/ and the _bzr function definition from the latter overwrites the one from the former. That's just a packaging problem, though.

Branch with patches to fix the -- and the quoting issues is available.

Jelmer Vernooij (jelmer)
Changed in bzr:
status: Confirmed → Fix Released
Changed in bzr (Ubuntu):
status: Confirmed → 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.