Re: [PATCH] notmuch: Add "maildir:" search option
authorJani Nikula <jani@nikula.org>
Tue, 12 Nov 2013 21:32:23 +0000 (23:32 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:58:14 +0000 (09:58 -0800)
d5/d8c12faea92e63572961076889a0fcd5e18772 [new file with mode: 0644]

diff --git a/d5/d8c12faea92e63572961076889a0fcd5e18772 b/d5/d8c12faea92e63572961076889a0fcd5e18772
new file mode 100644 (file)
index 0000000..04b4c45
--- /dev/null
@@ -0,0 +1,96 @@
+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 59CB2431FD7\r
+       for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 13:32:43 -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 lgZYRcSfHlTL for <notmuch@notmuchmail.org>;\r
+       Tue, 12 Nov 2013 13:32:31 -0800 (PST)\r
+Received: from mail-bk0-f48.google.com (mail-bk0-f48.google.com\r
+       [209.85.214.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id D5D93431FCF\r
+       for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 13:32:30 -0800 (PST)\r
+Received: by mail-bk0-f48.google.com with SMTP id u15so832061bkz.7\r
+       for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 13:32:29 -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:in-reply-to:references\r
+       :user-agent:date:message-id:mime-version:content-type;\r
+       bh=M/YbBzezTzw00UXgIqqaAuPxmaN09QDUyL4xikGrmOE=;\r
+       b=Pz1AFkdRcEdec5ZVorv2D4iQueoR80Hdq+B0pupLRSDP+I8l5VR0XCncH5JAa5mxi5\r
+       h+AV++s8l0YG0tvZkG3B7dc8h/C5mAoVzN9sUFxmAkGp677e/AjPDUfl5MTpvMuF4fVA\r
+       sCEyPuHZKU8s/nBO0T+ZmfvtmpKQHpGgvqdJFGThEIXIiRnYgSEQggsKIB2XwIENDGEm\r
+       trMTWglRE7BlshAgQD9qm3jIqn88oJQPLCHdfekOWjxD0CzawnfQ9rpMb9pIqllV87fj\r
+       NPy37pN2CL2/vF1zGDkNuFVOfY0LSKwo9l9M09M1dFDHFvmloOCUop4kupb0Z9YrjPzF\r
+       gCow==\r
+X-Gm-Message-State:\r
+ ALoCoQk0UWZVIDt/qVN621Dz8DgGrZsWoU8qq7HomXDVrTIYQqt6VLAW1pu2J/eGQnbYUaHocWrA\r
+X-Received: by 10.204.200.78 with SMTP id ev14mr3228617bkb.32.1384291949523;\r
+       Tue, 12 Nov 2013 13:32:29 -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 w9sm19898744bkn.12.2013.11.12.13.32.27\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Tue, 12 Nov 2013 13:32:28 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Peter Zijlstra <peterz@infradead.org>,\r
+       Austin Clements <aclements@csail.mit.edu>\r
+Subject: Re: [PATCH] notmuch: Add "maildir:" search option\r
+In-Reply-To: <20131112194727.GE16796@laptop.programming.kicks-ass.net>\r
+References: <20131112155637.GA16796@laptop.programming.kicks-ass.net>\r
+       <87mwl94dte.fsf@awakening.csail.mit.edu>\r
+       <20131112194727.GE16796@laptop.programming.kicks-ass.net>\r
+User-Agent: Notmuch/0.16+145~gebbaa94 (http://notmuchmail.org) Emacs/24.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Tue, 12 Nov 2013 23:32:23 +0200\r
+Message-ID: <87ob5pi9w8.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+Cc: notmuch@notmuchmail.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: Tue, 12 Nov 2013 21:32:43 -0000\r
+\r
+On Tue, 12 Nov 2013, Peter Zijlstra <peterz@infradead.org> wrote:\r
+> On Tue, Nov 12, 2013 at 02:31:25PM -0500, Austin Clements wrote:\r
+>> > +    /* Strip the maildir "cur", "new" directory entries. */\r
+>> > +    i = strlen(maildir);\r
+>> > +    if (strncmp(maildir + i - 3, "cur", 3) == 0 ||\r
+>> > + strncmp(maildir + i - 3, "new", 3) == 0) {\r
+>> \r
+>> This is unsafe if directory is less than three characters, which I\r
+>> believe could happen if the message is in the root mail directory (which\r
+>> shouldn't happen with a well-formed maildir, but notmuch doesn't require\r
+>> maildir, and, regardless, we should be defensive).\r
+>> \r
+>> Also, we have a STRNCMP_LITERAL macro that we often use for comparisons\r
+>> with string literals, but I'm good with this, too.\r
+>\r
+> Quite so, I haven't actually seen that, but you're quite right.\r
+\r
+FWIW, in this particular case you can just strcmp because you are\r
+looking at the end of maildir.\r
+\r
+BR,\r
+Jani.\r
+\r