unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: Jani Nikula <jani@nikula.org>,
	notmuch@notmuchmail.org, Rob Browning <rlb@defaultvalue.org>
Subject: Re: [PATCH 0/3] check new.tags for invalid tags
Date: Sun, 23 Feb 2014 20:21:59 +0200	[thread overview]
Message-ID: <m21tytu1tk.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <cover.1393174108.git.jani@nikula.org>

On Sun, Feb 23 2014, Jani Nikula <jani@nikula.org> wrote:

> 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.

LGTM.

$ notmuch tag + -- id:edc2bc900f75bb2e72be2037e2df9105be7f0273.1393174108.git.jani@nikula.org
Error: empty tag forbiddenzsh: exit 1     notmuch tag + --

$ notmuch restore --accumulate
+ id:edc2bc900f75bb2e72be2037e2df9105be7f0273.1393174108.git.jani@nikula.org
<ctrl-d -- exit value 0> -- notmuch search shows space after ( to inform
there is empty tag.

$ notmuch tag - -- id:edc2bc900f75bb2e72be2037e2df9105be7f0273.1393174108.git.jani@nikula.org
<no output -- exit value 0>

notmuch search no longer shows space after (

Also, SomeBody(tm) should add '\n' to the fprintf() in tag-util.c:175 (line
number after applying these patches).

Tomi

>
> 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
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  parent reply	other threads:[~2014-02-23 18:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-23  2:29 [BUG] Putting "tags=;" into .notmuch-config will create empty tags Rob Browning
2014-02-23 16:55 ` [PATCH 0/3] check new.tags for invalid tags Jani Nikula
2014-02-23 16:55   ` [PATCH 1/3] cli: export function for illegal tag checking Jani Nikula
2014-02-23 16:55   ` [PATCH 2/3] cli: make sure notmuch new and insert don't add invalid tags Jani Nikula
2014-02-23 16:55   ` [PATCH 3/3] test: add tests for invalid new.tags Jani Nikula
2014-02-23 18:21   ` Tomi Ollila [this message]
2014-03-04 16:51     ` [PATCH] cli: add missing \n in error message Jani Nikula
2014-03-06 11:51   ` [PATCH 0/3] check new.tags for invalid tags David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21tytu1tk.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    --cc=rlb@defaultvalue.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).