1 Return-Path: <dkg@fifthhorseman.net>
\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 B3ED46DE02DD
\r
6 for <notmuch@notmuchmail.org>; Fri, 1 Apr 2016 18:50:29 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id YRAGzcKQhmN8 for <notmuch@notmuchmail.org>;
\r
16 Fri, 1 Apr 2016 18:50:21 -0700 (PDT)
\r
17 Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])
\r
18 by arlo.cworth.org (Postfix) with ESMTP id 994166DE0281
\r
19 for <notmuch@notmuchmail.org>; Fri, 1 Apr 2016 18:50:16 -0700 (PDT)
\r
20 Received: from fifthhorseman.net (unknown [190.172.4.74])
\r
21 by che.mayfirst.org (Postfix) with ESMTPSA id 3C305F99D
\r
22 for <notmuch@notmuchmail.org>; Fri, 1 Apr 2016 21:50:15 -0400 (EDT)
\r
23 Received: by fifthhorseman.net (Postfix, from userid 1000)
\r
24 id 83EFD203D9; Fri, 1 Apr 2016 20:31:55 -0300 (BRT)
\r
25 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
\r
26 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
27 Subject: [PATCH 2/2] fix thread breakage via ghost-on-removal
\r
28 Date: Fri, 1 Apr 2016 20:31:55 -0300
\r
29 Message-Id: <1459553515-18802-2-git-send-email-dkg@fifthhorseman.net>
\r
30 X-Mailer: git-send-email 2.8.0.rc3
\r
31 In-Reply-To: <1459553515-18802-1-git-send-email-dkg@fifthhorseman.net>
\r
32 References: <1459445693-3900-1-git-send-email-dkg@fifthhorseman.net>
\r
33 <1459553515-18802-1-git-send-email-dkg@fifthhorseman.net>
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.20
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Sat, 02 Apr 2016 01:50:29 -0000
\r
48 This is the solution to T590-thread-breakage.sh that just adds a ghost
\r
49 message after removing each message.
\r
51 It leaks information about whether we've ever seen a given message id,
\r
52 but it's a fairly simple implementation.
\r
54 Note that _resolve_message_id_to_thread_id also introduces new
\r
55 message_ids to the database, so i think just searching for a given
\r
56 message ID may introduce the same metadata leakage.
\r
58 lib/database.cc | 28 ++++++++++++++++++++++++++--
\r
59 1 file changed, 26 insertions(+), 2 deletions(-)
\r
61 diff --git a/lib/database.cc b/lib/database.cc
\r
62 index 3b342f1..6c9e34a 100644
\r
63 --- a/lib/database.cc
\r
64 +++ b/lib/database.cc
\r
65 @@ -2557,9 +2557,33 @@ notmuch_database_remove_message (notmuch_database_t *notmuch,
\r
67 if (status == NOTMUCH_STATUS_SUCCESS && message) {
\r
68 status = _notmuch_message_remove_filename (message, filename);
\r
69 - if (status == NOTMUCH_STATUS_SUCCESS)
\r
70 + if (status == NOTMUCH_STATUS_SUCCESS) {
\r
71 + const char *mid, *tid;
\r
72 + notmuch_message_t *ghost;
\r
73 + notmuch_private_status_t private_status;
\r
75 + mid = notmuch_message_get_message_id (message);
\r
76 + tid = notmuch_message_get_thread_id (message);
\r
77 + /* remove the message */
\r
78 _notmuch_message_delete (message);
\r
79 - else if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)
\r
81 + /* and reintroduce a ghost in its place */
\r
82 + ghost = _notmuch_message_create_for_message_id (notmuch, mid, &private_status);
\r
83 + if (private_status == NOTMUCH_PRIVATE_STATUS_SUCCESS) {
\r
84 + /* this is deeply weird, and we should not have
\r
85 + gotten into this state. is there a better
\r
86 + error message to return here? */
\r
87 + status = NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;
\r
88 + } else if (private_status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) {
\r
89 + private_status = _notmuch_message_initialize_ghost (ghost, tid);
\r
90 + if (! private_status) {
\r
91 + _notmuch_message_sync (ghost);
\r
92 + notmuch_message_destroy (ghost);
\r
96 + status = COERCE_STATUS (private_status, "Error converting to ghost message");
\r
97 + } else if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)
\r
98 _notmuch_message_sync (message);
\r
100 notmuch_message_destroy (message);
\r