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 B327C6DE1435
\r
6 for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 12:54:50 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=1.237 tagged_above=-999 required=5 tests=[AWL=-0.159,
\r
12 SPF_NEUTRAL=0.652, URIBL_SBL=0.644, URIBL_SBL_A=0.1] 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 ER95b4xdUcz4 for <notmuch@notmuchmail.org>;
\r
16 Sun, 16 Aug 2015 12:54:48 -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 A37B66DE142C
\r
19 for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 12:54:47 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 46E9D1000E6;
\r
22 Sun, 16 Aug 2015 22:53:36 +0300 (EEST)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH] cli/lib: remove support for GMime 2.4
\r
26 In-Reply-To: <1439739201-11068-1-git-send-email-david@tethera.net>
\r
27 References: <1439739201-11068-1-git-send-email-david@tethera.net>
\r
28 User-Agent: Notmuch/0.20.2+61~g367bd06 (http://notmuchmail.org) Emacs/24.3.1
\r
29 (x86_64-unknown-linux-gnu)
\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
31 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
32 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
33 Date: Sun, 16 Aug 2015 22:53:36 +0300
\r
34 Message-ID: <m2k2sv2enz.fsf@guru.guru-group.fi>
\r
36 Content-Type: text/plain
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.18
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Sun, 16 Aug 2015 19:54:50 -0000
\r
51 On Sun, Aug 16 2015, David Bremner <david@tethera.net> wrote:
\r
53 > It's becoming a maintenance burden to do anything things with the
\r
54 > crypto glue code twice, once for 2.4 and once for 2.6. I don't have
\r
55 > any 2.4 version available to test on my development machine anymore,
\r
56 > so the 2.4 specific code paths are likely not very well tested.
\r
59 > I started to rebase the SMIME signature verification patches and got
\r
60 > aggravated at solving the same conflicts twice in every file.
\r
62 > 2.6.7 is from 2012, so that's a bit newer than some of our
\r
63 > requirements, but I think not so bad. YMMV.
\r
65 Perhaps it is time for me to update to gmime 2.6 in this machine. PITA ;/
\r
71 > configure | 49 ++++++++++-----------------------
\r
72 > crypto.c | 25 -----------------
\r
73 > mime-node.c | 83 -------------------------------------------------------
\r
74 > notmuch-show.c | 87 ----------------------------------------------------------
\r
75 > 5 files changed, 17 insertions(+), 233 deletions(-)
\r
77 > diff --git a/INSTALL b/INSTALL
\r
78 > index eaccd93..b1b9cd5 100644
\r
81 > @@ -20,7 +20,7 @@ configure stage.
\r
85 > -Notmuch depends on four libraries: Xapian, GMime 2.4 or 2.6,
\r
86 > +Notmuch depends on four libraries: Xapian, GMime 2.6,
\r
87 > Talloc, and zlib which are each described below:
\r
90 > @@ -39,8 +39,8 @@ Talloc, and zlib which are each described below:
\r
91 > reading mail while notmuch would wait for Xapian when removing
\r
92 > the "inbox" and "unread" tags from messages in a thread.
\r
94 > - GMime 2.4 or 2.6
\r
95 > - ----------------
\r
98 > GMime provides decoding of MIME email messages for Notmuch.
\r
100 > Without GMime, Notmuch would not be able to extract and index
\r
101 > diff --git a/configure b/configure
\r
102 > index d289880..440d678 100755
\r
105 > @@ -71,16 +71,6 @@ WITH_BASH=1
\r
109 > -# Compatible GMime versions (with constraints).
\r
110 > -# If using GMime 2.6, we need to have a version >= 2.6.5 to avoid a
\r
111 > -# crypto bug. We need 2.6.7 for permissive "From " header handling.
\r
112 > -GMIME_24_VERSION_CTR=''
\r
113 > -GMIME_24_VERSION="gmime-2.4 $GMIME_24_VERSION_CTR"
\r
114 > -GMIME_26_VERSION_CTR='>= 2.6.7'
\r
115 > -GMIME_26_VERSION="gmime-2.6 $GMIME_26_VERSION_CTR"
\r
117 > -WITH_GMIME_VERSIONS="$GMIME_26_VERSION;$GMIME_24_VERSION"
\r
122 > @@ -140,10 +130,6 @@ Fine tuning of some installation directories is available:
\r
123 > --bashcompletiondir=DIR Bash completions files [SYSCONFDIR/bash_completion.d]
\r
124 > --zshcompletiondir=DIR Zsh completions files [PREFIX/share/zsh/functions/Completion/Unix]
\r
126 > -Some specific library versions can be specified (auto-detected otherwise):
\r
128 > - --with-gmime-version=VERS Specify GMIME version (2.4 or 2.6)
\r
130 > Some features can be disabled (--with-feature=no is equivalent to
\r
131 > --without-feature) :
\r
133 > @@ -231,12 +217,6 @@ for option; do
\r
135 > elif [ "${option}" = '--without-zsh-completion' ] ; then
\r
137 > - elif [ "${option%%=*}" = '--with-gmime-version' ] ; then
\r
138 > - if [ "${option#*=}" = '2.4' ]; then
\r
139 > - WITH_GMIME_VERSIONS=$GMIME_24_VERSION
\r
140 > - elif [ "${option#*=}" = '2.6' ]; then
\r
141 > - WITH_GMIME_VERSIONS=$GMIME_26_VERSION
\r
143 > elif [ "${option%%=*}" = '--build' ] ; then
\r
145 > elif [ "${option%%=*}" = '--host' ] ; then
\r
146 > @@ -391,20 +371,19 @@ if [ ${have_xapian} = "1" ]; then
\r
151 > +# we need to have a version >= 2.6.5 to avoid a crypto bug. We need
\r
152 > +# 2.6.7 for permissive "From " header handling.
\r
153 > +GMIME_MINVER=2.6.7
\r
155 > printf "Checking for GMime development files... "
\r
158 > -for gmimepc in $WITH_GMIME_VERSIONS; do
\r
159 > - if pkg-config --exists $gmimepc; then
\r
160 > - printf "Yes ($gmimepc).\n"
\r
162 > - gmime_cflags=$(pkg-config --cflags $gmimepc)
\r
163 > - gmime_ldflags=$(pkg-config --libs $gmimepc)
\r
167 > -IFS=$DEFAULT_IFS
\r
168 > -if [ "$have_gmime" = "0" ]; then
\r
169 > +if pkg-config --exists "gmime-2.6 >= $GMIME_MINVER"; then
\r
170 > + printf "Yes.\n"
\r
172 > + gmime_cflags=$(pkg-config --cflags gmime-2.6)
\r
173 > + gmime_ldflags=$(pkg-config --libs gmime-2.6)
\r
177 > errors=$((errors + 1))
\r
179 > @@ -640,7 +619,7 @@ EOF
\r
182 > if [ $have_gmime -eq 0 ]; then
\r
183 > - echo " Either GMime 2.4 library" $GMIME_24_VERSION_CTR "or GMime 2.6 library" $GMIME_26_VERSION_CTR
\r
184 > + echo " GMime 2.6 library >= $GMIME_MINVER"
\r
185 > echo " (including development files such as headers)"
\r
186 > echo " http://spruce.sourceforge.net/gmime/"
\r
188 > @@ -1026,7 +1005,7 @@ LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
\r
189 > XAPIAN_CXXFLAGS = ${xapian_cxxflags}
\r
190 > XAPIAN_LDFLAGS = ${xapian_ldflags}
\r
192 > -# Flags needed to compile and link against GMime-2.4
\r
193 > +# Flags needed to compile and link against GMime
\r
194 > GMIME_CFLAGS = ${gmime_cflags}
\r
195 > GMIME_LDFLAGS = ${gmime_ldflags}
\r
197 > diff --git a/crypto.c b/crypto.c
\r
198 > index 026640f..a6eb27d 100644
\r
201 > @@ -20,8 +20,6 @@
\r
203 > #include "notmuch-client.h"
\r
205 > -#ifdef GMIME_ATLEAST_26
\r
207 > /* Create a GPG context (GMime 2.6) */
\r
208 > static notmuch_crypto_context_t *
\r
209 > create_gpg_context (const char *gpgpath)
\r
210 > @@ -39,29 +37,6 @@ create_gpg_context (const char *gpgpath)
\r
214 > -#else /* GMIME_ATLEAST_26 */
\r
216 > -/* Create a GPG context (GMime 2.4) */
\r
217 > -static notmuch_crypto_context_t *
\r
218 > -create_gpg_context (const char* gpgpath)
\r
220 > - GMimeSession *session;
\r
221 > - notmuch_crypto_context_t *gpgctx;
\r
223 > - session = g_object_new (g_mime_session_get_type (), NULL);
\r
224 > - gpgctx = g_mime_gpg_context_new (session, gpgpath ? gpgpath : "gpg");
\r
225 > - g_object_unref (session);
\r
230 > - g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, FALSE);
\r
235 > -#endif /* GMIME_ATLEAST_26 */
\r
237 > /* for the specified protocol return the context pointer (initializing
\r
239 > notmuch_crypto_context_t *
\r
240 > diff --git a/mime-node.c b/mime-node.c
\r
241 > index fd9e4a4..e96e663 100644
\r
242 > --- a/mime-node.c
\r
243 > +++ b/mime-node.c
\r
244 > @@ -129,8 +129,6 @@ DONE:
\r
248 > -#ifdef GMIME_ATLEAST_26
\r
250 > /* Signature list destructor (GMime 2.6) */
\r
252 > _signature_list_free (GMimeSignatureList **proxy)
\r
253 > @@ -205,87 +203,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
\r
254 > g_error_free (err);
\r
257 > -#else /* GMIME_ATLEAST_26 */
\r
259 > -/* Signature validity destructor (GMime 2.4) */
\r
261 > -_signature_validity_free (GMimeSignatureValidity **proxy)
\r
263 > - g_mime_signature_validity_free (*proxy);
\r
267 > -/* Set up signature validity destructor (GMime 2.4) */
\r
269 > -set_signature_validity_destructor (mime_node_t *node,
\r
270 > - GMimeSignatureValidity *sig_validity)
\r
272 > - GMimeSignatureValidity **proxy = talloc (node, GMimeSignatureValidity *);
\r
274 > - *proxy = sig_validity;
\r
275 > - talloc_set_destructor (proxy, _signature_validity_free);
\r
279 > -/* Verify a signed mime node (GMime 2.4) */
\r
281 > -node_verify (mime_node_t *node, GMimeObject *part,
\r
282 > - notmuch_crypto_context_t *cryptoctx)
\r
284 > - GError *err = NULL;
\r
285 > - GMimeSignatureValidity *sig_validity;
\r
287 > - node->verify_attempted = TRUE;
\r
288 > - sig_validity = g_mime_multipart_signed_verify
\r
289 > - (GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
\r
290 > - node->sig_validity = sig_validity;
\r
291 > - if (sig_validity) {
\r
292 > - set_signature_validity_destructor (node, sig_validity);
\r
294 > - fprintf (stderr, "Failed to verify signed part: %s\n",
\r
295 > - err ? err->message : "no error explanation given");
\r
299 > - g_error_free (err);
\r
302 > -/* Decrypt and optionally verify an encrypted mime node (GMime 2.4) */
\r
304 > -node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
\r
305 > - notmuch_crypto_context_t *cryptoctx)
\r
307 > - GError *err = NULL;
\r
308 > - GMimeMultipartEncrypted *encrypteddata = GMIME_MULTIPART_ENCRYPTED (part);
\r
310 > - node->decrypt_attempted = TRUE;
\r
311 > - node->decrypted_child = g_mime_multipart_encrypted_decrypt
\r
312 > - (encrypteddata, cryptoctx, &err);
\r
313 > - if (! node->decrypted_child) {
\r
314 > - fprintf (stderr, "Failed to decrypt part: %s\n",
\r
315 > - err ? err->message : "no error explanation given");
\r
319 > - node->decrypt_success = TRUE;
\r
320 > - node->verify_attempted = TRUE;
\r
322 > - /* The GMimeSignatureValidity returned here is a const, unlike the
\r
323 > - * one returned by g_mime_multipart_signed_verify() in
\r
324 > - * node_verify() above, so the destructor is not needed.
\r
326 > - node->sig_validity = g_mime_multipart_encrypted_get_signature_validity (encrypteddata);
\r
327 > - if (! node->sig_validity)
\r
328 > - fprintf (stderr, "Failed to verify encrypted signed part: %s\n",
\r
329 > - err ? err->message : "no error explanation given");
\r
333 > - g_error_free (err);
\r
336 > -#endif /* GMIME_ATLEAST_26 */
\r
338 > static mime_node_t *
\r
339 > _mime_node_create (mime_node_t *parent, GMimeObject *part)
\r
341 > diff --git a/notmuch-show.c b/notmuch-show.c
\r
342 > index b80933a..21015fd 100644
\r
343 > --- a/notmuch-show.c
\r
344 > +++ b/notmuch-show.c
\r
345 > @@ -334,8 +334,6 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,
\r
346 > g_object_unref(stream_filter);
\r
349 > -#ifdef GMIME_ATLEAST_26
\r
351 > /* Get signature status string (GMime 2.6) */
\r
352 > static const char*
\r
353 > signature_status_to_string (GMimeSignatureStatus x)
\r
354 > @@ -427,91 +425,6 @@ format_part_sigstatus_sprinter (sprinter_t *sp, mime_node_t *node)
\r
358 > -#else /* GMIME_ATLEAST_26 */
\r
360 > -/* Get signature status string (GMime 2.4) */
\r
361 > -static const char*
\r
362 > -signer_status_to_string (GMimeSignerStatus x)
\r
365 > - case GMIME_SIGNER_STATUS_NONE:
\r
367 > - case GMIME_SIGNER_STATUS_GOOD:
\r
369 > - case GMIME_SIGNER_STATUS_BAD:
\r
371 > - case GMIME_SIGNER_STATUS_ERROR:
\r
372 > - return "error";
\r
374 > - return "unknown";
\r
377 > -/* Signature status sprinter (GMime 2.4) */
\r
379 > -format_part_sigstatus_sprinter (sprinter_t *sp, mime_node_t *node)
\r
381 > - const GMimeSignatureValidity* validity = node->sig_validity;
\r
383 > - sp->begin_list (sp);
\r
385 > - if (!validity) {
\r
390 > - const GMimeSigner *signer = g_mime_signature_validity_get_signers (validity);
\r
391 > - while (signer) {
\r
392 > - sp->begin_map (sp);
\r
395 > - sp->map_key (sp, "status");
\r
396 > - sp->string (sp, signer_status_to_string (signer->status));
\r
398 > - if (signer->status == GMIME_SIGNER_STATUS_GOOD)
\r
400 > - if (signer->fingerprint) {
\r
401 > - sp->map_key (sp, "fingerprint");
\r
402 > - sp->string (sp, signer->fingerprint);
\r
404 > - /* these dates are seconds since the epoch; should we
\r
405 > - * provide a more human-readable format string? */
\r
406 > - if (signer->created) {
\r
407 > - sp->map_key (sp, "created");
\r
408 > - sp->integer (sp, signer->created);
\r
410 > - if (signer->expires) {
\r
411 > - sp->map_key (sp, "expires");
\r
412 > - sp->integer (sp, signer->expires);
\r
414 > - /* output user id only if validity is FULL or ULTIMATE. */
\r
415 > - /* note that gmime is using the term "trust" here, which
\r
416 > - * is WRONG. It's actually user id "validity". */
\r
417 > - if ((signer->name) && (signer->trust)) {
\r
418 > - if ((signer->trust == GMIME_SIGNER_TRUST_FULLY) || (signer->trust == GMIME_SIGNER_TRUST_ULTIMATE)) {
\r
419 > - sp->map_key (sp, "userid");
\r
420 > - sp->string (sp, signer->name);
\r
424 > - if (signer->keyid) {
\r
425 > - sp->map_key (sp, "keyid");
\r
426 > - sp->string (sp, signer->keyid);
\r
429 > - if (signer->errors != GMIME_SIGNER_ERROR_NONE) {
\r
430 > - sp->map_key (sp, "errors");
\r
431 > - sp->integer (sp, signer->errors);
\r
435 > - signer = signer->next;
\r
441 > -#endif /* GMIME_ATLEAST_26 */
\r
443 > static notmuch_status_t
\r
444 > format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,
\r
445 > int indent, const notmuch_show_params_t *params)
\r
449 > _______________________________________________
\r
450 > notmuch mailing list
\r
451 > notmuch@notmuchmail.org
\r
452 > http://notmuchmail.org/mailman/listinfo/notmuch
\r