From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 36F176DE0A6C for ; Sun, 2 Apr 2017 06:17:04 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.005 X-Spam-Level: X-Spam-Status: No, score=-0.005 tagged_above=-999 required=5 tests=[AWL=0.006, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-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 jwu_8LtoCAil for ; Sun, 2 Apr 2017 06:17:03 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 344F16DE091C for ; Sun, 2 Apr 2017 06:17:03 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1cufMf-0003C8-GW; Sun, 02 Apr 2017 09:16:17 -0400 Received: (nullmailer pid 30017 invoked by uid 1000); Sun, 02 Apr 2017 13:16:56 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [rfc patch v2 5/5] lib: index message files with duplicate message-ids Date: Sun, 2 Apr 2017 10:16:46 -0300 Message-Id: <20170402131646.29884-6-david@tethera.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170402131646.29884-1-david@tethera.net> References: <20170402131646.29884-1-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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, 02 Apr 2017 13:17:04 -0000 The corresponding xapian document just gets more terms added to it, but this doesn't seem to break anything. --- lib/database.cc | 3 +++ test/T670-duplicate-mid.sh | 22 +++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 5bc131a3..3b9f7828 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -2582,6 +2582,9 @@ notmuch_database_add_message (notmuch_database_t *notmuch, if (ret) goto DONE; } else { + ret = _notmuch_message_index_file (message, message_file); + if (ret) + goto DONE; ret = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID; } diff --git a/test/T670-duplicate-mid.sh b/test/T670-duplicate-mid.sh index 88bd12cb..2c77e11e 100755 --- a/test/T670-duplicate-mid.sh +++ b/test/T670-duplicate-mid.sh @@ -2,11 +2,10 @@ test_description="duplicate message ids" . ./test-lib.sh || exit 1 -add_message '[id]="id:duplicate"' '[subject]="message 1"' -add_message '[id]="id:duplicate"' '[subject]="message 2"' +add_message '[id]="duplicate"' '[subject]="message 1"' +add_message '[id]="duplicate"' '[subject]="message 2"' test_begin_subtest 'Search for second subject' -test_subtest_known_broken cat <EXPECTED MAIL_DIR/msg-001 MAIL_DIR/msg-002 @@ -14,4 +13,21 @@ EOF notmuch search --output=files subject:'"message 2"' | notmuch_dir_sanitize > OUTPUT test_expect_equal_file EXPECTED OUTPUT +add_message '[id]="duplicate"' '[body]="sekrit"' +test_begin_subtest 'search for body in duplicate file' +cat <EXPECTED +MAIL_DIR/msg-001 +MAIL_DIR/msg-002 +MAIL_DIR/msg-003 +EOF +notmuch search --output=files "sekrit" | notmuch_dir_sanitize > OUTPUT +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest 'reindex removes terms from duplicate file' +rm $MAIL_DIR/msg-003 +notmuch reindex id:duplicate +cp /dev/null EXPECTED +notmuch search --output=files "sekrit" | notmuch_dir_sanitize > OUTPUT +test_expect_equal_file EXPECTED OUTPUT + test_done -- 2.11.0