Re: Applying patches directly from emails?
[notmuch-archives.git] / 2d / b3ab379cf15c22685b0b8fd349fd100f59e534
1 Return-Path: <ma.skies@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 0CC52431FD0\r
6         for <notmuch@notmuchmail.org>; Mon, 27 Jun 2011 10:12:28 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id isbJvWrSBj4a for <notmuch@notmuchmail.org>;\r
17         Mon, 27 Jun 2011 10:12:27 -0700 (PDT)\r
18 Received: from mail-iw0-f181.google.com (mail-iw0-f181.google.com\r
19         [209.85.214.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 6289E431FB6\r
22         for <notmuch@notmuchmail.org>; Mon, 27 Jun 2011 10:12:27 -0700 (PDT)\r
23 Received: by iwn37 with SMTP id 37so5064013iwn.26\r
24         for <notmuch@notmuchmail.org>; Mon, 27 Jun 2011 10:12:27 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=domainkey-signature:from:to:subject:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=IoF+uM1TyyoxE40SfXomxa3VEKR9LusiUE+VHr7NaKk=;\r
29         b=Ps+P6p/lu64DhNKClkjvNzk+5GaWeLtvqPlX2B3Owy8mBkLrmjmA/i3iCJUtKDP7Ru\r
30         jUsD6vkto8LsGXoGzZLpgwgPyI3/lzVH63uBC0M/N94zgaM0IsYQXkxgBvQUsV2k1xS5\r
31         jkSy7f7zfbYz+dmXqvMn2zHjI4SGZX0fX9Rvw=\r
32 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
33         h=from:to:subject:user-agent:date:message-id:mime-version\r
34         :content-type;\r
35         b=FCH0eVFn6h+8WbYDafOo6oie/aWMF3X7fJ83CQQb/yfDM08IYW20XWWcFCdqo728XG\r
36         lObrjyYcjonO7mRvHrIKuMs0miwsqy1s8rnnWsONvvWDQZH0eMsQAUiaGf/N7dPNNzek\r
37         2hpv413k343I+lIVCiUXxr6OoE6ffqfT302JM=\r
38 Received: by 10.42.133.67 with SMTP id g3mr7729196ict.51.1309194746748;\r
39         Mon, 27 Jun 2011 10:12:26 -0700 (PDT)\r
40 Received: from localhost ([74.205.145.146])\r
41         by mx.google.com with ESMTPS id a9sm5531558icy.18.2011.06.27.10.12.25\r
42         (version=TLSv1/SSLv3 cipher=OTHER);\r
43         Mon, 27 Jun 2011 10:12:26 -0700 (PDT)\r
44 From: Mark Anderson <ma.skies@gmail.com>\r
45 To: notmuch@notmuchmail.org\r
46 Subject: [PATCH] test:Folder tags shouldn't match after removal of file in\r
47         given folder\r
48 User-Agent: Notmuch/0.5-283-gb744eac (http://notmuchmail.org) Emacs/23.2.1\r
49         (i686-pc-linux-gnu)\r
50 Date: Mon, 27 Jun 2011 11:12:24 -0600\r
51 Message-ID: <87sjqvw64n.fsf@gmail.com>\r
52 MIME-Version: 1.0\r
53 Content-Type: text/plain; charset=us-ascii\r
54 X-BeenThere: notmuch@notmuchmail.org\r
55 X-Mailman-Version: 2.1.13\r
56 Precedence: list\r
57 List-Id: "Use and development of the notmuch mail system."\r
58         <notmuch.notmuchmail.org>\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
62 List-Post: <mailto:notmuch@notmuchmail.org>\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
66 X-List-Received-Date: Mon, 27 Jun 2011 17:12:28 -0000\r
67 \r
68 \r
69 Test for bug.  Current stemming support for notmuch adds extra terms\r
70 to the DB which aren't removed when the file renames are detected.\r
71 \r
72 When folder tags are added to a message, Xapian terms for both XFOLDER\r
73 and ZXFOLDER are generated.  When one of the filenames are\r
74 renamed/removed, only the XFOLDER tags are removed, leaving it possible\r
75 for a match on a folder: tag that was previously but is no longer a\r
76 match in the maildir.\r
77 ---\r
78 \r
79 I found this bug last week.  Essentially when the folder:spam tag is\r
80 added and puts the XFOLDERspam, it also inserts the ZXFOLDERspam.  Then\r
81 if the mail is removed from the folder, it neglects to remove\r
82 ZXFOLDERspam.\r
83 \r
84 This was detected with my offlineimap usage with gmail, still haven't\r
85 polished my personal folder/label transition.  As I was looking into it,\r
86 I saw some unusual things flagged as spam, and investigated.\r
87 \r
88  test/notmuch-test            |    1 +\r
89  test/search-folder-coherence |   48 ++++++++++++++++++++++++++++++++++++++++++\r
90  2 files changed, 49 insertions(+), 0 deletions(-)\r
91  create mode 100755 test/search-folder-coherence\r
92 \r
93 diff --git a/test/notmuch-test b/test/notmuch-test\r
94 index fe85c6a..79e6267 100755\r
95 --- a/test/notmuch-test\r
96 +++ b/test/notmuch-test\r
97 @@ -41,6 +41,7 @@ TESTS="\r
98    maildir-sync\r
99    crypto\r
100    symbol-hiding\r
101 +  search-folder-coherence\r
102  "\r
103  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
104  \r
105 diff --git a/test/search-folder-coherence b/test/search-folder-coherence\r
106 new file mode 100755\r
107 index 0000000..cf3ba40\r
108 --- /dev/null\r
109 +++ b/test/search-folder-coherence\r
110 @@ -0,0 +1,48 @@\r
111 +#!/usr/bin/env bash\r
112 +test_description='folder tags removed and added through file renames remain consistent'\r
113 +. ./test-lib.sh\r
114 +\r
115 +test_begin_subtest "No new messages"\r
116 +output=$(NOTMUCH_NEW)\r
117 +test_expect_equal "$output" "No new mail."\r
118 +\r
119 +\r
120 +test_begin_subtest "Single new message"\r
121 +generate_message\r
122 +file_x=$gen_msg_filename\r
123 +id_x=$gen_msg_id\r
124 +output=$(NOTMUCH_NEW)\r
125 +test_expect_equal "$output" "Added 1 new message to the database."\r
126 +\r
127 +test_begin_subtest "Add second folder for same message"\r
128 +dir=$(dirname $file_x)\r
129 +mkdir $dir/spam\r
130 +cp $file_x $dir/spam\r
131 +output=$(NOTMUCH_NEW)\r
132 +test_expect_equal "$output" "No new mail."\r
133 +\r
134 +\r
135 +test_begin_subtest "Multiple files for same message"\r
136 +cat <<EOF >EXPECTED\r
137 +MAIL_DIR/msg-001\r
138 +MAIL_DIR/spam/msg-001\r
139 +EOF\r
140 +notmuch search --output=files id:$id_x | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT\r
141 +test_expect_equal_file OUTPUT EXPECTED\r
142 +\r
143 +test_begin_subtest "Test matches folder:spam"\r
144 +output=$(notmuch search folder:spam)\r
145 +test_expect_equal "$output" "thread:0000000000000001   2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)"\r
146 +\r
147 +sleep 1;\r
148 +\r
149 +test_begin_subtest "Remove folder:spam copy of email"\r
150 +rm $dir/spam/$(basename $file_x)\r
151 +output=$(NOTMUCH_NEW)\r
152 +test_expect_equal "$output" "No new mail. Detected 1 file rename."\r
153 +\r
154 +test_begin_subtest "No mails match the folder:spam search"\r
155 +output=$(notmuch search folder:spam)\r
156 +test_expect_equal "$output" ""\r
157 +\r
158 +test_done\r
159 -- \r
160 1.7.4.1\r
161 \r