Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / df / 3ef580593652b2e9b121f880fc9f360cd84a12
1 Return-Path: <tomi.ollila@iki.fi>\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 90E146DE034D\r
6  for <notmuch@notmuchmail.org>; Mon,  4 Apr 2016 23:53:31 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.625\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.625 tagged_above=-999 required=5 tests=[AWL=-0.027,\r
12   SPF_NEUTRAL=0.652] autolearn=disabled\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 Kw2KJrRbRnui for <notmuch@notmuchmail.org>;\r
16  Mon,  4 Apr 2016 23:53:21 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18  by arlo.cworth.org (Postfix) with ESMTP id 9E2F56DE02C2\r
19  for <notmuch@notmuchmail.org>; Mon,  4 Apr 2016 23:53:20 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21  by guru.guru-group.fi (Postfix) with ESMTP id ED20F1000E0;\r
22  Tue,  5 Apr 2016 09:53:34 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,\r
25  Notmuch Mail <notmuch@notmuchmail.org>\r
26 Subject: Re: [PATCH v2 3/7] fix thread breakage via ghost-on-removal\r
27 In-Reply-To: <1459606541-23889-3-git-send-email-dkg@fifthhorseman.net>\r
28 References: <1459445693-3900-1-git-send-email-dkg@fifthhorseman.net>\r
29  <1459606541-23889-1-git-send-email-dkg@fifthhorseman.net>\r
30  <1459606541-23889-3-git-send-email-dkg@fifthhorseman.net>\r
31 User-Agent: Notmuch/0.21+99~g7cbc880 (http://notmuchmail.org) Emacs/24.3.1\r
32  (x86_64-unknown-linux-gnu)\r
33 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
34  $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
35  !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
36 Date: Tue, 05 Apr 2016 09:53:34 +0300\r
37 Message-ID: <m2lh4sczrl.fsf@guru.guru-group.fi>\r
38 MIME-Version: 1.0\r
39 Content-Type: text/plain\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.20\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44  <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
46  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
51  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Tue, 05 Apr 2016 06:53:31 -0000\r
53 \r
54 On Sat, Apr 02 2016, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:\r
55 \r
56 > ghost-on-removal the solution to T590-thread-breakage.sh that just\r
57 > adds a ghost message after removing each message.\r
58 >\r
59 > It leaks information about whether we've ever seen a given message id,\r
60 > but it's a fairly simple implementation.\r
61 >\r
62 > Note that _resolve_message_id_to_thread_id also introduces new\r
63 > message_ids to the database, so i think just searching for a given\r
64 > message ID may introduce the same metadata leakage.\r
65 >\r
66 > This differs from v1 of this changeset in that we implement the change\r
67 > in _notmuch_message_delete, a more "internal" function.\r
68 \r
69 I fetched your changes from lair.fifthhorseman.net yesterday and diffed\r
70 against master; looks pretty good, some quick comments (this email has\r
71 most relevant changes related to those changes):\r
72 \r
73 > ---\r
74 >  lib/database.cc |  2 +-\r
75 >  lib/message.cc  | 29 ++++++++++++++++++++++++++---\r
76 >  2 files changed, 27 insertions(+), 4 deletions(-)\r
77 >\r
78 > diff --git a/lib/database.cc b/lib/database.cc\r
79 > index 3b342f1..d5733c9 100644\r
80 > --- a/lib/database.cc\r
81 > +++ b/lib/database.cc\r
82 > @@ -2557,7 +2557,7 @@ notmuch_database_remove_message (notmuch_database_t *notmuch,\r
83 >  \r
84 >      if (status == NOTMUCH_STATUS_SUCCESS && message) {\r
85 >           status = _notmuch_message_remove_filename (message, filename);\r
86 > -         if (status == NOTMUCH_STATUS_SUCCESS)\r
87 > +         if (status == NOTMUCH_STATUS_SUCCESS) \r
88 \r
89 It looks to be that this change is insignificant enough so it could be\r
90 dropped ;)\r
91 \r
92 >               _notmuch_message_delete (message);\r
93 >           else if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID)\r
94 >               _notmuch_message_sync (message);\r
95 > diff --git a/lib/message.cc b/lib/message.cc\r
96 > index 8d72ea2..e414e9c 100644\r
97 > --- a/lib/message.cc\r
98 > +++ b/lib/message.cc\r
99 > @@ -1037,20 +1037,43 @@ _notmuch_message_sync (notmuch_message_t *message)\r
100 >      message->modified = FALSE;\r
101 >  }\r
102 >  \r
103 > -/* Delete a message document from the database. */\r
104 > +/* Delete a message document from the database, leaving a ghost\r
105 > + * message in its place */\r
106 \r
107 This comment could tell the condition when ghost message is left --\r
108 versus the case all ghost messages are dropped (thread becomes empty of\r
109 mail messages).\r
110 \r
111 >  notmuch_status_t\r
112 >  _notmuch_message_delete (notmuch_message_t *message)\r
113 >  {\r
114 >      notmuch_status_t status;\r
115 >      Xapian::WritableDatabase *db;\r
116 > +    const char *mid, *tid;\r
117 > +    notmuch_message_t *ghost;\r
118 > +    notmuch_private_status_t private_status;\r
119 > +    notmuch_database_t *notmuch;\r
120 > +         \r
121 > +    mid = notmuch_message_get_message_id (message);\r
122 > +    tid = notmuch_message_get_thread_id (message);\r
123 > +    notmuch = message->notmuch;\r
124 >  \r
125 >      status = _notmuch_database_ensure_writable (message->notmuch);\r
126 >      if (status)\r
127 >       return status;\r
128 >  \r
129 > -    db = static_cast <Xapian::WritableDatabase *> (message->notmuch->xapian_db);\r
130 > +    db = static_cast <Xapian::WritableDatabase *> (notmuch->xapian_db);\r
131 >      db->delete_document (message->doc_id);\r
132 > -    return NOTMUCH_STATUS_SUCCESS;\r
133 > +         \r
134 > +    /* and reintroduce a ghost in its place */\r
135 > +    ghost = _notmuch_message_create_for_message_id (notmuch, mid, &private_status);\r
136 \r
137 In next lines the expected case NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND\r
138 could be first. Although the performance difference is negligible to me\r
139 it looks silly do this first check and basically always fail there and\r
140 then do 'else if' which is likely to succeeed...\r
141 (your latest version in lair does not return in this first case but sets\r
142 status to NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID. Perhaps later messages in this\r
143 thread does the same but those are somewhat out-of-context for this reply).\r
144 \r
145 > +    if (private_status == NOTMUCH_PRIVATE_STATUS_SUCCESS) {\r
146 > +     /* this is deeply weird, and we should not have gotten into\r
147 > +        this state.  is there a better error message to return\r
148 > +        here? */\r
149 > +     return NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID;\r
150 > +    } else if (private_status == NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND) {\r
151 > +     private_status = _notmuch_message_initialize_ghost (ghost, tid);\r
152 > +     if (! private_status)\r
153 > +         _notmuch_message_sync (ghost);\r
154 > +    }\r
155 > +    notmuch_message_destroy (ghost);\r
156 > +    return COERCE_STATUS (private_status, "Error converting to ghost message");\r
157 >  }\r
158 \r
159 Outside of this patch, but in some of the next messages, adds functions\r
160 _notmuch_message_has_term() and _notmuch_message_has_term_st(). Perhaps\r
161 the _notmuch_message_has_term() could be left unimplemented?\r
162 \r
163 >  \r
164 >  /* Transform a blank message into a ghost message.  The caller must\r
165 > -- \r
166 > 2.8.0.rc3\r
167 >\r
168 > _______________________________________________\r
169 > notmuch mailing list\r
170 > notmuch@notmuchmail.org\r
171 > https://notmuchmail.org/mailman/listinfo/notmuch\r