[PATCH 0/3] check new.tags for invalid tags
authorJani Nikula <jani@nikula.org>
Sun, 23 Feb 2014 16:55:20 +0000 (18:55 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:00:12 +0000 (10:00 -0800)
99/e625582e2ed24e7bb546bd0e69967b7e1b263e [new file with mode: 0644]

diff --git a/99/e625582e2ed24e7bb546bd0e69967b7e1b263e b/99/e625582e2ed24e7bb546bd0e69967b7e1b263e
new file mode 100644 (file)
index 0000000..a03cf59
--- /dev/null
@@ -0,0 +1,108 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 1A37C429E32\r
+       for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 08:55:39 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id NRCDxlebVxTe for <notmuch@notmuchmail.org>;\r
+       Sun, 23 Feb 2014 08:55:33 -0800 (PST)\r
+Received: from mail-ee0-f42.google.com (mail-ee0-f42.google.com\r
+ [74.125.83.42])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 53412431FD8   for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 08:55:31 -0800\r
+ (PST)\r
+Received: by mail-ee0-f42.google.com with SMTP id e53so1085795eek.29\r
+       for <notmuch@notmuchmail.org>; Sun, 23 Feb 2014 08:55:27 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+       :references;\r
+       bh=j4xJ+TiJeAuK1GA4z2ixk2nLz8qpGNwCBGGck+/yhwU=;\r
+       b=AC9AtFG/87cNBavpZPuJ9IqJq1jgx/3Kr8AMToBonvL0/XeJWdh2onf4uFRmw0eBx3\r
+       fMv8VhkwrGO1cv+yylFBW4jkHqERCnwGqoCtX3XF01Dt9CreP5lU6qn8PeznZxMfUPvn\r
+       QWdElRhfWzJq57swnieoiGRqEXhPQieTVRX45O4gnlxrihKL78OeensQUjmHf2rMuGge\r
+       jcuAvgA17653+WvGsEMw/erGkGVgbEgb2ddfnjjhkNu5lP2ver64Dobos0kKe+r/nGa/\r
+       rUenpstYrGBHVjqMeJdEFr/UuWWfb1zK9TPKNwJeD9nn7fImfR9CvUjKwTIlfKgY6rFj\r
+       nJEw==\r
+X-Gm-Message-State:\r
+ ALoCoQkl4zZkIVpc9XJsg1LoFUcU6FpGaBhxlQIcE80ObGEjdaySQsh85sKxgNQOmxVe82XF/NTa\r
+X-Received: by 10.15.48.1 with SMTP id g1mr19451364eew.51.1393174527246;\r
+       Sun, 23 Feb 2014 08:55:27 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+       [88.195.111.91])\r
+       by mx.google.com with ESMTPSA id m1sm53062062een.7.2014.02.23.08.55.25\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sun, 23 Feb 2014 08:55:26 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org,\r
+       Rob Browning <rlb@defaultvalue.org>\r
+Subject: [PATCH 0/3] check new.tags for invalid tags\r
+Date: Sun, 23 Feb 2014 18:55:20 +0200\r
+Message-Id: <cover.1393174108.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.5.3\r
+In-Reply-To: <87ha7qfto7.fsf@trouble.defaultvalue.org>\r
+References: <87ha7qfto7.fsf@trouble.defaultvalue.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 23 Feb 2014 16:55:39 -0000\r
+\r
+On Sun, 23 Feb 2014, Rob Browning <rlb@defaultvalue.org> wrote:\r
+> In the [new] section, "tags=;" will cause notmuch to create empty tags\r
+> that are fairly hard to remove from the command line.\r
+\r
+Clearly broken. This series fixes the issue at the cli\r
+level. (Forbidding empty tags at the lib level is slightly more\r
+complicated, as we would still have to ensure old dump files can be\r
+restored.)\r
+\r
+> After some help on #bup, here's what I came up with to remove them,\r
+> though it assumes that the empty tag "+ " will always be first in dump's\r
+> output:\r
+>\r
+>   notmuch dump --format=batch-tag 'tag:""' | perl -pe 's/^\+ //' \\r
+>     | notmuch restore --format=batch-tag\r
+>\r
+> And note that you have to use restore, "notmuch tag --batch" doesn't\r
+> appear to accept "- " as a tag, even though dump will produce "+ ".\r
+\r
+I didn't check this further, but the regular, non-batch notmuch tag\r
+should still work for removal of empty tags.\r
+\r
+BR,\r
+Jani.\r
+\r
+Jani Nikula (3):\r
+  cli: export function for illegal tag checking\r
+  cli: make sure notmuch new and insert don't add invalid tags\r
+  test: add tests for invalid new.tags\r
+\r
+ notmuch-insert.c    |  9 +++++++++\r
+ notmuch-new.c       | 14 +++++++++++++-\r
+ tag-util.c          |  9 +--------\r
+ tag-util.h          | 12 ++++++++++++\r
+ test/T050-new.sh    | 17 +++++++++++++++++\r
+ test/T070-insert.sh | 19 +++++++++++++++++++\r
+ 6 files changed, 71 insertions(+), 9 deletions(-)\r
+\r
+-- \r
+1.8.5.3\r
+\r