From 4b9c0fe23a9c98f027f71b00d4262d4170a6f8b9 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Sun, 23 Feb 2014 20:21:59 +0200 Subject: [PATCH] Re: [PATCH 0/3] check new.tags for invalid tags --- 8c/059908954fcb7f7cf0bab5600f3cc6a6886f38 | 120 ++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 8c/059908954fcb7f7cf0bab5600f3cc6a6886f38 diff --git a/8c/059908954fcb7f7cf0bab5600f3cc6a6886f38 b/8c/059908954fcb7f7cf0bab5600f3cc6a6886f38 new file mode 100644 index 000000000..ce8432286 --- /dev/null +++ b/8c/059908954fcb7f7cf0bab5600f3cc6a6886f38 @@ -0,0 +1,120 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id F2D7E431FD6 + for ; Sun, 23 Feb 2014 10:22:35 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ij5ZMNJWp-0l for ; + Sun, 23 Feb 2014 10:22:23 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 3A780431FCF + for ; Sun, 23 Feb 2014 10:22:22 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id A34ED100064; + Sun, 23 Feb 2014 20:21:59 +0200 (EET) +From: Tomi Ollila +To: Jani Nikula , notmuch@notmuchmail.org, + Rob Browning +Subject: Re: [PATCH 0/3] check new.tags for invalid tags +In-Reply-To: +References: <87ha7qfto7.fsf@trouble.defaultvalue.org> + +User-Agent: Notmuch/0.17+94~g1b90823 (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 23 Feb 2014 18:22:36 -0000 + +On Sun, Feb 23 2014, Jani Nikula wrote: + +> On Sun, 23 Feb 2014, Rob Browning 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 + -- notmuch search shows space after ( to inform +there is empty tag. + +$ notmuch tag - -- id:edc2bc900f75bb2e72be2037e2df9105be7f0273.1393174108.git.jani@nikula.org + + +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 -- 2.26.2