Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / e1 / 088a690781b5c4166bf574d38e4e69f5ad815a
1 Return-Path: <jani@nikula.org>\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 arlo.cworth.org (Postfix) with ESMTP id 7755F6DE1502\r
6  for <notmuch@notmuchmail.org>; Sat,  5 Sep 2015 02:35:42 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.503\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.503 tagged_above=-999 required=5 tests=[AWL=0.217,\r
12   RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]\r
13  autolearn=disabled\r
14 Received: from arlo.cworth.org ([127.0.0.1])\r
15  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
16  with ESMTP id GCwYthGC22yN for <notmuch@notmuchmail.org>;\r
17  Sat,  5 Sep 2015 02:35:39 -0700 (PDT)\r
18 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
19  [209.85.212.181])\r
20  by arlo.cworth.org (Postfix) with ESMTPS id 7CE836DE14C7\r
21  for <notmuch@notmuchmail.org>; Sat,  5 Sep 2015 02:35:38 -0700 (PDT)\r
22 Received: by wicfx3 with SMTP id fx3so43312752wic.1\r
23  for <notmuch@notmuchmail.org>; Sat, 05 Sep 2015 02:35:36 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25  d=1e100.net; s=20130820;\r
26  h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
27  :references;\r
28  bh=KebmCKtD+8/r1KiZ5d9C+8ZuarOPzuHiC+1dG7Dcxgo=;\r
29  b=InAflQb3QbKolBCaJlSzSoIZPw+JC22ZEXX+7rGB8UaSdtTQlEFjFhKVprX8vMN/+N\r
30  DbAByvlR5mJaMQSbq1WIAreXMVZ+68lMaPJ/TQL3ZtlmyUrKpd5KrTo9/7pSRXIFu40e\r
31  teUK/8bbH2h/GEPUJHbfVdH+1f4v6v9w1Aeb6d9AaFv440/VsgJ7EU68SGJHzthPegAF\r
32  neMmEPYQKfRc8THAD2V+EaLNPdfND2SzGGQ0xxEIyuEeiI1JGMFDYmyoLin+vOCyuKNp\r
33  14v5Thwy21o6NgtTI2XYn3B6voAiccGLmWCzh+OmZrhrXedFiT173v77DodQUJHFOI22\r
34  g5OQ==\r
35 X-Gm-Message-State:\r
36  ALoCoQkn5C8XM62u6JIFs48ljEnGHEfkl9UWL8p7zlO66/ej6xq8yQabdHX/85cvpz8GwxhMGRU3\r
37 X-Received: by 10.180.91.131 with SMTP id ce3mr15967415wib.84.1441445736378;\r
38  Sat, 05 Sep 2015 02:35:36 -0700 (PDT)\r
39 Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi.\r
40  [188.238.79.131])\r
41  by smtp.gmail.com with ESMTPSA id s9sm8951926wjy.16.2015.09.05.02.35.35\r
42  (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
43  Sat, 05 Sep 2015 02:35:35 -0700 (PDT)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: Mark Walters <markwalters1009@gmail.com>,\r
46         notmuch@notmuchmail.org\r
47 Subject: [PATCH 1/2] HACK: test: test folder renames\r
48 Date: Sat,  5 Sep 2015 12:35:30 +0300\r
49 Message-Id: <1441445731-4362-1-git-send-email-jani@nikula.org>\r
50 X-Mailer: git-send-email 2.1.4\r
51 In-Reply-To: <87siray6th.fsf@qmul.ac.uk>\r
52 References: <87siray6th.fsf@qmul.ac.uk>\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.18\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57  <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Sat, 05 Sep 2015 09:35:42 -0000\r
66 \r
67 On Sun, 23 Feb 2014, Mark Walters <markwalters1009@gmail.com> wrote [1]:\r
68 > I was experimenting with letting notmuch new take an argument to tell it\r
69 > to scan only a particular directory (and sub-directories) for new\r
70 > messages. I came across the following strange behaviour which is also\r
71 > present in master (with a fresh database)\r
72 >\r
73 > I have a bunch of maildirs in /home/mail: so folders .mail.foo/\r
74 > .mail.bar/ each of which has cur/new/tmp and all the messages are in\r
75 > cur.\r
76 >\r
77 > If I do mv .mail.foo .mail.bar/ and run notmuch new I get the expected\r
78 > lots of renames (900 or so in the case I was trying). But if I then do\r
79 > mv .mail.bar/.mail.foo . and run notmuch new almost all the messages get\r
80 > removed (but 30 renames do get detected). If I then do touch .mail.foo/*\r
81 > the messages get found again\r
82 >\r
83 > I am guessing the 30 renames might be because those 30 have duplicates\r
84 > somewhere else.\r
85 >\r
86 > But the other behaviour has me puzzled.\r
87 \r
88 This test reproduces the problem for me, but it's not deterministic,\r
89 and I've been unable to make it so. Thus there's a loop of 100\r
90 attempts, and usually I hit the problem several times like this:\r
91 \r
92  FAIL   Rename folder back\r
93  --- T051-new-renames.27.expected       2014-02-23 21:37:10.121774241 +0000\r
94  +++ T051-new-renames.27.output         2014-02-23 21:37:10.121774241 +0000\r
95  @@ -1 +1 @@\r
96  -No new mail. Detected 10 file renames.\r
97  +No new mail. Removed 10 messages.\r
98  FAIL   Files remain the same\r
99  --- T051-new-renames.28.expected       2014-02-23 21:37:10.133774652 +0000\r
100  +++ T051-new-renames.28.output         2014-02-23 21:37:10.133774652 +0000\r
101  @@ -1,13 +1,3 @@\r
102  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-121\r
103  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-122\r
104  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-123\r
105  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-124\r
106  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-125\r
107  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-126\r
108  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-127\r
109  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-128\r
110  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-129\r
111  -/path/to/test/tmp.T051-new-renames/mail/foo/msg-130\r
112   /path/to/test/tmp.T051-new-renames/mail/bar/msg-131\r
113   /path/to/test/tmp.T051-new-renames/mail/bar/msg-132\r
114   /path/to/test/tmp.T051-new-renames/mail/bar/msg-133\r
115 \r
116 This test is not suitable for merging since it's not\r
117 deterministic. But maybe it's good enough to assess the patch that\r
118 follows.\r
119 \r
120 [1] id:87siray6th.fsf@qmul.ac.uk\r
121 ---\r
122  test/T051-new-renames.sh | 40 ++++++++++++++++++++++++++++++++++++++++\r
123  1 file changed, 40 insertions(+)\r
124  create mode 100755 test/T051-new-renames.sh\r
125 \r
126 diff --git a/test/T051-new-renames.sh b/test/T051-new-renames.sh\r
127 new file mode 100755\r
128 index 000000000000..3c1515da1085\r
129 --- /dev/null\r
130 +++ b/test/T051-new-renames.sh\r
131 @@ -0,0 +1,40 @@\r
132 +#!/usr/bin/env bash\r
133 +test_description='"notmuch new" with directory renames'\r
134 +. ./test-lib.sh\r
135 +\r
136 +for loop in `seq 100`; do\r
137 +\r
138 +rm -rf ${MAIL_DIR}\r
139 +\r
140 +for i in `seq 10`; do\r
141 +    generate_message '[dir]=foo' '[subject]="Message foo $i"'\r
142 +done\r
143 +\r
144 +for i in `seq 10`; do\r
145 +    generate_message '[dir]=bar' '[subject]="Message bar $i"'\r
146 +done\r
147 +\r
148 +test_begin_subtest "Index the messages, round $loop"\r
149 +output=$(NOTMUCH_NEW)\r
150 +test_expect_equal "$output" "Added 20 new messages to the database."\r
151 +\r
152 +all_files=$(notmuch search --output=files \*)\r
153 +count_foo=$(notmuch count folder:foo)\r
154 +\r
155 +test_begin_subtest "Rename folder foo -> baz"\r
156 +mv ${MAIL_DIR}/foo ${MAIL_DIR}/baz\r
157 +output=$(NOTMUCH_NEW)\r
158 +test_expect_equal "$output" "No new mail. Detected $count_foo file renames."\r
159 +\r
160 +test_begin_subtest "Rename folder back baz -> foo"\r
161 +mv ${MAIL_DIR}/baz ${MAIL_DIR}/foo\r
162 +output=$(NOTMUCH_NEW)\r
163 +test_expect_equal "$output" "No new mail. Detected $count_foo file renames."\r
164 +\r
165 +test_begin_subtest "Files remain the same"\r
166 +output=$(notmuch search --output=files \*)\r
167 +test_expect_equal "$output" "$all_files"\r
168 +\r
169 +done\r
170 +\r
171 +test_done\r
172 -- \r
173 2.1.4\r
174 \r