/etc/bash_completion.d/mutt quotes tilde which cannot be expanded by bash (or: why is query_command invoked at this place at all?)
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_
- "_muttquery" calls "mutt -Q query_command", which in my case returns the string
query_command=
- "_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
ProcVersionSign
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)
PackageArchitec
ProcEnviron:
PATH=(custom, user)
LANG=en_IE.utf8
SHELL=/bin/bash
SourcePackage: bash-completion
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.