From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id EB273431FD6 for ; Sun, 23 Feb 2014 13:41:01 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AFtJYEo8V-XN for ; Sun, 23 Feb 2014 13:40:55 -0800 (PST) Received: from mail-ee0-f50.google.com (mail-ee0-f50.google.com [74.125.83.50]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 78F94431FCF for ; Sun, 23 Feb 2014 13:40:55 -0800 (PST) Received: by mail-ee0-f50.google.com with SMTP id d17so2802557eek.9 for ; Sun, 23 Feb 2014 13:40:52 -0800 (PST) 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=3kRBxEHl0fbxx2T0N5Ir/ommIVcUgRGFfaKCuMUy+tQ=; b=c/SkuS9WVSweTB3O6qTPC62dC51CzTd0hKgtn1Kv23Cipd8XY0frqnyJn82RLeS2xb dh5XqM8N7ocqyzUlEx3PJ3kVbaqoIfwSOqMGLJCWFYGc7BDoVPiw1oEoeq7lhEoJSLsL boRlhltPIc+vVxqP8B23lIwaYamrlq4YWPFM7aP8rNt76ZgqzjtWWX9vptXca0vEaVtd 1xUb3loWYW38wZeHc8SnLmDdMo3NU99ynuwKzfki9QSRnYKQM4KyaqVgcvnfxeqtS7ng eVo1ymfNK6q5nggcVTT+mxkXSKyOKlbfbZSqBPHxBYbFjOmWn5UaVC9SJUvj2oMlHSVm WEcQ== X-Gm-Message-State: ALoCoQnDKoQqKRN/hyOnRBH6mwGO9N+ph+m1EUiMxdM42qErm7aeonQBsBySIht07xkVoXCYhkRC X-Received: by 10.15.21.2 with SMTP id c2mr20941297eeu.77.1393191652739; Sun, 23 Feb 2014 13:40:52 -0800 (PST) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id q44sm55731714eez.1.2014.02.23.13.40.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 23 Feb 2014 13:40:51 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org, Mark Walters Subject: [PATCH] test: test folder renames Date: Sun, 23 Feb 2014 23:40:50 +0200 Message-Id: <1393191650-28333-1-git-send-email-jani@nikula.org> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <87siray6th.fsf@qmul.ac.uk> References: <87siray6th.fsf@qmul.ac.uk> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Sun, 23 Feb 2014 21:41:02 -0000 On Sun, 23 Feb 2014, Mark Walters wrote: > 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. With the loop, I get roughly one fail per test run: 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 I'm as puzzled as you are. BR, Jani. --- 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..febe006f5888 --- /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 10`; 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" +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" +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 -- 1.8.5.3