/etc/bash_completion.d/mutt quotes tilde which cannot be expanded by bash (or: why is query_command invoked at this place at all?)

Bug #655849 reported by Gernot Salzer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash-completion (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: bash-completion

Expected vs observed behaviour
==============================
When typing
$ mutt -f =k<TAB>
bash-completion should offer mailboxes starting with "k"

Instead, bash gives the error message
$ mutt -f =kbash: ~/.mutt/muttquery: No such file or directory

Bug 1: Completion produces a bash error
Bug 2: Completion executes mutt's query_command, which is intended for retrieving email addresses, not mail boxes

Analysis
========
- Pressing <TAB> invokes bash completion, which calls "_muttquery" from /etc/bash_completion.d/mutt
- "_muttquery" calls "mutt -Q query_command", which in my case returns the string
query_command="~/.mutt/muttquery '%s'"
- "_muttquery" extracts the substring "~/.mutt/muttquery '%s'" (without surrounding quotes), replaces %s by "'\''k'\''" (without surrounding quotes), and then executes the bash command
'~/.mutt/muttquery' ''\''k'\'''

Since the tilde is quoted by single quotes, bash does not expand it to the home dir, but interprets it literally. Hence the observed bash error message.

Bug 1: Completion should not single-quote tildes which are expected to be expanded by bash.
Bug 2: Completion should not call _muttquery since there is no mail address expected after "-f ="

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: bash-completion 1:1.1-3ubuntu2
ProcVersionSignature: Ubuntu 2.6.32-25.44-generic 2.6.32.21+drm33.7
Uname: Linux 2.6.32-25-generic i686
Architecture: i386
Date: Wed Oct 6 18:08:40 2010
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release i386 (20100816.1)
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_IE.utf8
 SHELL=/bin/bash
SourcePackage: bash-completion

Revision history for this message
Gernot Salzer (salzer) wrote :
description: updated
description: updated
Revision history for this message
Peter Cordes (peter-cordes) wrote :

not reproducible on trusty. I have mutt installed, but my mailserver is an old Debian box that I ssh to and run mutt on, so I don't have anything but the default mutt setup to test with easily on current Ubuntu.

reopen if this is still actually broken.

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.