Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 0CC52431FD0 for ; Mon, 27 Jun 2011 10:12:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, 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 isbJvWrSBj4a for ; Mon, 27 Jun 2011 10:12:27 -0700 (PDT) Received: from mail-iw0-f181.google.com (mail-iw0-f181.google.com [209.85.214.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 6289E431FB6 for ; Mon, 27 Jun 2011 10:12:27 -0700 (PDT) Received: by iwn37 with SMTP id 37so5064013iwn.26 for ; Mon, 27 Jun 2011 10:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:user-agent:date:message-id :mime-version:content-type; bh=IoF+uM1TyyoxE40SfXomxa3VEKR9LusiUE+VHr7NaKk=; b=Ps+P6p/lu64DhNKClkjvNzk+5GaWeLtvqPlX2B3Owy8mBkLrmjmA/i3iCJUtKDP7Ru jUsD6vkto8LsGXoGzZLpgwgPyI3/lzVH63uBC0M/N94zgaM0IsYQXkxgBvQUsV2k1xS5 jkSy7f7zfbYz+dmXqvMn2zHjI4SGZX0fX9Rvw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:user-agent:date:message-id:mime-version :content-type; b=FCH0eVFn6h+8WbYDafOo6oie/aWMF3X7fJ83CQQb/yfDM08IYW20XWWcFCdqo728XG lObrjyYcjonO7mRvHrIKuMs0miwsqy1s8rnnWsONvvWDQZH0eMsQAUiaGf/N7dPNNzek 2hpv413k343I+lIVCiUXxr6OoE6ffqfT302JM= Received: by 10.42.133.67 with SMTP id g3mr7729196ict.51.1309194746748; Mon, 27 Jun 2011 10:12:26 -0700 (PDT) Received: from localhost ([74.205.145.146]) by mx.google.com with ESMTPS id a9sm5531558icy.18.2011.06.27.10.12.25 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 27 Jun 2011 10:12:26 -0700 (PDT) From: Mark Anderson To: notmuch@notmuchmail.org Subject: [PATCH] test:Folder tags shouldn't match after removal of file in given folder User-Agent: Notmuch/0.5-283-gb744eac (http://notmuchmail.org) Emacs/23.2.1 (i686-pc-linux-gnu) Date: Mon, 27 Jun 2011 11:12:24 -0600 Message-ID: <87sjqvw64n.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Mon, 27 Jun 2011 17:12:28 -0000 Test for bug. Current stemming support for notmuch adds extra terms to the DB which aren't removed when the file renames are detected. When folder tags are added to a message, Xapian terms for both XFOLDER and ZXFOLDER are generated. When one of the filenames are renamed/removed, only the XFOLDER tags are removed, leaving it possible for a match on a folder: tag that was previously but is no longer a match in the maildir. --- I found this bug last week. Essentially when the folder:spam tag is added and puts the XFOLDERspam, it also inserts the ZXFOLDERspam. Then if the mail is removed from the folder, it neglects to remove ZXFOLDERspam. This was detected with my offlineimap usage with gmail, still haven't polished my personal folder/label transition. As I was looking into it, I saw some unusual things flagged as spam, and investigated. test/notmuch-test | 1 + test/search-folder-coherence | 48 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 0 deletions(-) create mode 100755 test/search-folder-coherence diff --git a/test/notmuch-test b/test/notmuch-test index fe85c6a..79e6267 100755 --- a/test/notmuch-test +++ b/test/notmuch-test @@ -41,6 +41,7 @@ TESTS=" maildir-sync crypto symbol-hiding + search-folder-coherence " TESTS=${NOTMUCH_TESTS:=$TESTS} diff --git a/test/search-folder-coherence b/test/search-folder-coherence new file mode 100755 index 0000000..cf3ba40 --- /dev/null +++ b/test/search-folder-coherence @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +test_description='folder tags removed and added through file renames remain consistent' +. ./test-lib.sh + +test_begin_subtest "No new messages" +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "No new mail." + + +test_begin_subtest "Single new message" +generate_message +file_x=$gen_msg_filename +id_x=$gen_msg_id +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "Added 1 new message to the database." + +test_begin_subtest "Add second folder for same message" +dir=$(dirname $file_x) +mkdir $dir/spam +cp $file_x $dir/spam +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "No new mail." + + +test_begin_subtest "Multiple files for same message" +cat <EXPECTED +MAIL_DIR/msg-001 +MAIL_DIR/spam/msg-001 +EOF +notmuch search --output=files id:$id_x | sed -e "s,$MAIL_DIR,MAIL_DIR," >OUTPUT +test_expect_equal_file OUTPUT EXPECTED + +test_begin_subtest "Test matches folder:spam" +output=$(notmuch search folder:spam) +test_expect_equal "$output" "thread:0000000000000001 2001-01-05 [1/1] Notmuch Test Suite; Test message #1 (inbox unread)" + +sleep 1; + +test_begin_subtest "Remove folder:spam copy of email" +rm $dir/spam/$(basename $file_x) +output=$(NOTMUCH_NEW) +test_expect_equal "$output" "No new mail. Detected 1 file rename." + +test_begin_subtest "No mails match the folder:spam search" +output=$(notmuch search folder:spam) +test_expect_equal "$output" "" + +test_done -- 1.7.4.1