notmuch-mutt: Fix tagging issues

This patch fixes three issues with "notmuch-mutt tag":

1. The message_id was not shell quoted.
   Thanks to Jason Miller for the bug report and patch.

2. The tags passed into tag_action() were not being properly quoted.
   The "join before shell_quote" was combining multiple tags into a
   single argument to notmuch tag: '+one -two -three' instead of
   '+one' '-two' '-three'.

3. A "--" was added between the tags and search-term as shown in the
   current notmuch-tag man page.

Thanks to Tomi Ollila for suggesting the simple fix of using
the list form of system(), which bypasses the shell.
This commit is contained in:
Kevin J. McCarthy 2013-09-07 10:07:57 -07:00 committed by David Bremner
parent fae15296ec
commit f3dc5be6f2

View file

@ -113,9 +113,7 @@ sub tag_action(@) {
my $mid = get_message_id(); my $mid = get_message_id();
defined $mid or die "notmuch-mutt: cannot find Message-Id, abort.\n"; defined $mid or die "notmuch-mutt: cannot find Message-Id, abort.\n";
system("notmuch tag " system("notmuch", "tag", @_, "--", "id:$mid");
. shell_quote(join(' ', @_))
. " id:$mid");
} }
sub die_usage() { sub die_usage() {