From: Jani Nikula Date: Sat, 5 Sep 2015 09:35:30 +0000 (+0300) Subject: [PATCH 1/2] HACK: test: test folder renames X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f826d16f868227b4aadcaebdc9cbecdeb24e81e5;p=notmuch-archives.git [PATCH 1/2] HACK: test: test folder renames --- diff --git a/e1/088a690781b5c4166bf574d38e4e69f5ad815a b/e1/088a690781b5c4166bf574d38e4e69f5ad815a new file mode 100644 index 000000000..aa24380be --- /dev/null +++ b/e1/088a690781b5c4166bf574d38e4e69f5ad815a @@ -0,0 +1,174 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 7755F6DE1502 + for ; Sat, 5 Sep 2015 02:35:42 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.503 +X-Spam-Level: +X-Spam-Status: No, score=-0.503 tagged_above=-999 required=5 tests=[AWL=0.217, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id GCwYthGC22yN for ; + Sat, 5 Sep 2015 02:35:39 -0700 (PDT) +Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com + [209.85.212.181]) + by arlo.cworth.org (Postfix) with ESMTPS id 7CE836DE14C7 + for ; Sat, 5 Sep 2015 02:35:38 -0700 (PDT) +Received: by wicfx3 with SMTP id fx3so43312752wic.1 + for ; Sat, 05 Sep 2015 02:35:36 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references; + bh=KebmCKtD+8/r1KiZ5d9C+8ZuarOPzuHiC+1dG7Dcxgo=; + b=InAflQb3QbKolBCaJlSzSoIZPw+JC22ZEXX+7rGB8UaSdtTQlEFjFhKVprX8vMN/+N + DbAByvlR5mJaMQSbq1WIAreXMVZ+68lMaPJ/TQL3ZtlmyUrKpd5KrTo9/7pSRXIFu40e + teUK/8bbH2h/GEPUJHbfVdH+1f4v6v9w1Aeb6d9AaFv440/VsgJ7EU68SGJHzthPegAF + neMmEPYQKfRc8THAD2V+EaLNPdfND2SzGGQ0xxEIyuEeiI1JGMFDYmyoLin+vOCyuKNp + 14v5Thwy21o6NgtTI2XYn3B6voAiccGLmWCzh+OmZrhrXedFiT173v77DodQUJHFOI22 + g5OQ== +X-Gm-Message-State: + ALoCoQkn5C8XM62u6JIFs48ljEnGHEfkl9UWL8p7zlO66/ej6xq8yQabdHX/85cvpz8GwxhMGRU3 +X-Received: by 10.180.91.131 with SMTP id ce3mr15967415wib.84.1441445736378; + Sat, 05 Sep 2015 02:35:36 -0700 (PDT) +Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi. + [188.238.79.131]) + by smtp.gmail.com with ESMTPSA id s9sm8951926wjy.16.2015.09.05.02.35.35 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sat, 05 Sep 2015 02:35:35 -0700 (PDT) +From: Jani Nikula +To: Mark Walters , + notmuch@notmuchmail.org +Subject: [PATCH 1/2] HACK: test: test folder renames +Date: Sat, 5 Sep 2015 12:35:30 +0300 +Message-Id: <1441445731-4362-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: <87siray6th.fsf@qmul.ac.uk> +References: <87siray6th.fsf@qmul.ac.uk> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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: Sat, 05 Sep 2015 09:35:42 -0000 + +On Sun, 23 Feb 2014, Mark Walters wrote [1]: +> I was experimenting with letting notmuch new take an argument to tell it +> to scan only a particular directory (and sub-directories) for new +> messages. I came across the following strange behaviour which is also +> present in master (with a fresh database) +> +> I have a bunch of maildirs in /home/mail: so folders .mail.foo/ +> .mail.bar/ each of which has cur/new/tmp and all the messages are in +> cur. +> +> If I do mv .mail.foo .mail.bar/ and run notmuch new I get the expected +> lots of renames (900 or so in the case I was trying). But if I then do +> mv .mail.bar/.mail.foo . and run notmuch new almost all the messages get +> removed (but 30 renames do get detected). If I then do touch .mail.foo/* +> the messages get found again +> +> I am guessing the 30 renames might be because those 30 have duplicates +> somewhere else. +> +> But the other behaviour has me puzzled. + +This test reproduces the problem for me, but it's not deterministic, +and I've been unable to make it so. Thus there's a loop of 100 +attempts, and usually I hit the problem several times like this: + + FAIL Rename folder back + --- T051-new-renames.27.expected 2014-02-23 21:37:10.121774241 +0000 + +++ T051-new-renames.27.output 2014-02-23 21:37:10.121774241 +0000 + @@ -1 +1 @@ + -No new mail. Detected 10 file renames. + +No new mail. Removed 10 messages. + FAIL Files remain the same + --- T051-new-renames.28.expected 2014-02-23 21:37:10.133774652 +0000 + +++ T051-new-renames.28.output 2014-02-23 21:37:10.133774652 +0000 + @@ -1,13 +1,3 @@ + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-121 + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-122 + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-123 + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-124 + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-125 + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-126 + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-127 + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-128 + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-129 + -/path/to/test/tmp.T051-new-renames/mail/foo/msg-130 + /path/to/test/tmp.T051-new-renames/mail/bar/msg-131 + /path/to/test/tmp.T051-new-renames/mail/bar/msg-132 + /path/to/test/tmp.T051-new-renames/mail/bar/msg-133 + +This test is not suitable for merging since it's not +deterministic. But maybe it's good enough to assess the patch that +follows. + +[1] id:87siray6th.fsf@qmul.ac.uk +--- + test/T051-new-renames.sh | 40 ++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + create mode 100755 test/T051-new-renames.sh + +diff --git a/test/T051-new-renames.sh b/test/T051-new-renames.sh +new file mode 100755 +index 000000000000..3c1515da1085 +--- /dev/null ++++ b/test/T051-new-renames.sh +@@ -0,0 +1,40 @@ ++#!/usr/bin/env bash ++test_description='"notmuch new" with directory renames' ++. ./test-lib.sh ++ ++for loop in `seq 100`; do ++ ++rm -rf ${MAIL_DIR} ++ ++for i in `seq 10`; do ++ generate_message '[dir]=foo' '[subject]="Message foo $i"' ++done ++ ++for i in `seq 10`; do ++ generate_message '[dir]=bar' '[subject]="Message bar $i"' ++done ++ ++test_begin_subtest "Index the messages, round $loop" ++output=$(NOTMUCH_NEW) ++test_expect_equal "$output" "Added 20 new messages to the database." ++ ++all_files=$(notmuch search --output=files \*) ++count_foo=$(notmuch count folder:foo) ++ ++test_begin_subtest "Rename folder foo -> baz" ++mv ${MAIL_DIR}/foo ${MAIL_DIR}/baz ++output=$(NOTMUCH_NEW) ++test_expect_equal "$output" "No new mail. Detected $count_foo file renames." ++ ++test_begin_subtest "Rename folder back baz -> foo" ++mv ${MAIL_DIR}/baz ${MAIL_DIR}/foo ++output=$(NOTMUCH_NEW) ++test_expect_equal "$output" "No new mail. Detected $count_foo file renames." ++ ++test_begin_subtest "Files remain the same" ++output=$(notmuch search --output=files \*) ++test_expect_equal "$output" "$all_files" ++ ++done ++ ++test_done +-- +2.1.4 +