[PATCH 0/3] check new.tags for invalid tags

Subject: [PATCH 0/3] check new.tags for invalid tags

Date: Sun, 23 Feb 2014 18:55:20 +0200

To: notmuch@notmuchmail.org, Rob Browning

Cc:

From: Jani Nikula


On Sun, 23 Feb 2014, Rob Browning <rlb@defaultvalue.org> wrote:
> In the [new] section, "tags=;" will cause notmuch to create empty tags
> that are fairly hard to remove from the command line.

Clearly broken. This series fixes the issue at the cli
level. (Forbidding empty tags at the lib level is slightly more
complicated, as we would still have to ensure old dump files can be
restored.)

> After some help on #bup, here's what I came up with to remove them,
> though it assumes that the empty tag "+ " will always be first in dump's
> output:
>
>   notmuch dump --format=batch-tag 'tag:""' | perl -pe 's/^\+ //' \
>     | notmuch restore --format=batch-tag
>
> And note that you have to use restore, "notmuch tag --batch" doesn't
> appear to accept "- " as a tag, even though dump will produce "+ ".

I didn't check this further, but the regular, non-batch notmuch tag
should still work for removal of empty tags.

BR,
Jani.

Jani Nikula (3):
  cli: export function for illegal tag checking
  cli: make sure notmuch new and insert don't add invalid tags
  test: add tests for invalid new.tags

 notmuch-insert.c    |  9 +++++++++
 notmuch-new.c       | 14 +++++++++++++-
 tag-util.c          |  9 +--------
 tag-util.h          | 12 ++++++++++++
 test/T050-new.sh    | 17 +++++++++++++++++
 test/T070-insert.sh | 19 +++++++++++++++++++
 6 files changed, 71 insertions(+), 9 deletions(-)

-- 
1.8.5.3


Thread: