Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / b9 / 01f2fb774930405d3daf62bb3ce24914fafdf5
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
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 1.237\r
10 X-Spam-Level: *\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
35 MIME-Version: 1.0\r
36 Content-Type: text/plain\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.18\r
39 Precedence: list\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
50 \r
51 On Sun, Aug 16 2015, David Bremner <david@tethera.net> wrote:\r
52 \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
57 > ---\r
58 >\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
61 >\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
64 \r
65 Perhaps it is time for me to update to gmime 2.6 in this machine. PITA ;/\r
66 \r
67 Tomi\r
68 \r
69 >\r
70 >  INSTALL        |  6 ++--\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
76 >\r
77 > diff --git a/INSTALL b/INSTALL\r
78 > index eaccd93..b1b9cd5 100644\r
79 > --- a/INSTALL\r
80 > +++ b/INSTALL\r
81 > @@ -20,7 +20,7 @@ configure stage.\r
82 >  \r
83 >  Dependencies\r
84 >  ------------\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
88 >  \r
89 >       Xapian\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
93 >  \r
94 > -     GMime 2.4 or 2.6\r
95 > -     ----------------\r
96 > +     GMime  2.6\r
97 > +     ----------\r
98 >       GMime provides decoding of MIME email messages for Notmuch.\r
99 >  \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
103 > --- a/configure\r
104 > +++ b/configure\r
105 > @@ -71,16 +71,6 @@ WITH_BASH=1\r
106 >  WITH_RUBY=1\r
107 >  WITH_ZSH=1\r
108 >  \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
116 > -\r
117 > -WITH_GMIME_VERSIONS="$GMIME_26_VERSION;$GMIME_24_VERSION"\r
118 > -\r
119 >  usage ()\r
120 >  {\r
121 >      cat <<EOF\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
125 >  \r
126 > -Some specific library versions can be specified (auto-detected otherwise):\r
127 > -\r
128 > -     --with-gmime-version=VERS       Specify GMIME version (2.4 or 2.6)\r
129 > -\r
130 >  Some features can be disabled (--with-feature=no is equivalent to\r
131 >  --without-feature) :\r
132 >  \r
133 > @@ -231,12 +217,6 @@ for option; do\r
134 >       fi\r
135 >      elif [ "${option}" = '--without-zsh-completion' ] ; then\r
136 >       WITH_ZSH=0\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
142 > -     fi\r
143 >      elif [ "${option%%=*}" = '--build' ] ; then\r
144 >       true\r
145 >      elif [ "${option%%=*}" = '--host' ] ; then\r
146 > @@ -391,20 +371,19 @@ if [ ${have_xapian} = "1" ]; then\r
147 >      esac\r
148 >  fi\r
149 >  \r
150 > +\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
154 > +\r
155 >  printf "Checking for GMime development files... "\r
156 > -have_gmime=0\r
157 > -IFS=';'\r
158 > -for gmimepc in $WITH_GMIME_VERSIONS; do\r
159 > -    if pkg-config --exists $gmimepc; then\r
160 > -     printf "Yes ($gmimepc).\n"\r
161 > -     have_gmime=1\r
162 > -     gmime_cflags=$(pkg-config --cflags $gmimepc)\r
163 > -     gmime_ldflags=$(pkg-config --libs $gmimepc)\r
164 > -     break\r
165 > -    fi\r
166 > -done\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
171 > +    have_gmime=1\r
172 > +    gmime_cflags=$(pkg-config --cflags gmime-2.6)\r
173 > +    gmime_ldflags=$(pkg-config --libs gmime-2.6)\r
174 > +else\r
175 > +    have_gmime=0\r
176 >      printf "No.\n"\r
177 >      errors=$((errors + 1))\r
178 >  fi\r
179 > @@ -640,7 +619,7 @@ EOF\r
180 >       echo\r
181 >      fi\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
187 >       echo\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
191 >  \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
196 >  \r
197 > diff --git a/crypto.c b/crypto.c\r
198 > index 026640f..a6eb27d 100644\r
199 > --- a/crypto.c\r
200 > +++ b/crypto.c\r
201 > @@ -20,8 +20,6 @@\r
202 >  \r
203 >  #include "notmuch-client.h"\r
204 >  \r
205 > -#ifdef GMIME_ATLEAST_26\r
206 > -\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
211 >      return gpgctx;\r
212 >  }\r
213 >  \r
214 > -#else /* GMIME_ATLEAST_26 */\r
215 > -\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
219 > -{\r
220 > -    GMimeSession *session;\r
221 > -    notmuch_crypto_context_t *gpgctx;\r
222 > -\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
226 > -\r
227 > -    if (! gpgctx)\r
228 > -     return NULL;\r
229 > -\r
230 > -    g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, FALSE);\r
231 > -\r
232 > -    return gpgctx;\r
233 > -}\r
234 > -\r
235 > -#endif /* GMIME_ATLEAST_26 */\r
236 > -\r
237 >  /* for the specified protocol return the context pointer (initializing\r
238 >   * if needed) */\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
245 >      return status;\r
246 >  }\r
247 >  \r
248 > -#ifdef GMIME_ATLEAST_26\r
249 > -\r
250 >  /* Signature list destructor (GMime 2.6) */\r
251 >  static int\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
255 >  }\r
256 >  \r
257 > -#else /* GMIME_ATLEAST_26 */\r
258 > -\r
259 > -/* Signature validity destructor (GMime 2.4) */\r
260 > -static int\r
261 > -_signature_validity_free (GMimeSignatureValidity **proxy)\r
262 > -{\r
263 > -    g_mime_signature_validity_free (*proxy);\r
264 > -    return 0;\r
265 > -}\r
266 > -\r
267 > -/* Set up signature validity destructor (GMime 2.4) */\r
268 > -static void\r
269 > -set_signature_validity_destructor (mime_node_t *node,\r
270 > -                                GMimeSignatureValidity *sig_validity)\r
271 > -{\r
272 > -    GMimeSignatureValidity **proxy = talloc (node, GMimeSignatureValidity *);\r
273 > -    if (proxy) {\r
274 > -     *proxy = sig_validity;\r
275 > -     talloc_set_destructor (proxy, _signature_validity_free);\r
276 > -    }\r
277 > -}\r
278 > -\r
279 > -/* Verify a signed mime node (GMime 2.4) */\r
280 > -static void\r
281 > -node_verify (mime_node_t *node, GMimeObject *part,\r
282 > -          notmuch_crypto_context_t *cryptoctx)\r
283 > -{\r
284 > -    GError *err = NULL;\r
285 > -    GMimeSignatureValidity *sig_validity;\r
286 > -\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
293 > -    } else {\r
294 > -     fprintf (stderr, "Failed to verify signed part: %s\n",\r
295 > -              err ? err->message : "no error explanation given");\r
296 > -    }\r
297 > -\r
298 > -    if (err)\r
299 > -     g_error_free (err);\r
300 > -}\r
301 > -\r
302 > -/* Decrypt and optionally verify an encrypted mime node (GMime 2.4) */\r
303 > -static void\r
304 > -node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,\r
305 > -                      notmuch_crypto_context_t *cryptoctx)\r
306 > -{\r
307 > -    GError *err = NULL;\r
308 > -    GMimeMultipartEncrypted *encrypteddata = GMIME_MULTIPART_ENCRYPTED (part);\r
309 > -\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
316 > -     goto DONE;\r
317 > -    }\r
318 > -\r
319 > -    node->decrypt_success = TRUE;\r
320 > -    node->verify_attempted = TRUE;\r
321 > -\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
325 > -     */\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
330 > -\r
331 > - DONE:\r
332 > -    if (err)\r
333 > -     g_error_free (err);\r
334 > -}\r
335 > -\r
336 > -#endif  /* GMIME_ATLEAST_26 */\r
337 > -\r
338 >  static mime_node_t *\r
339 >  _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
340 >  {\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
347 >  }\r
348 >  \r
349 > -#ifdef GMIME_ATLEAST_26\r
350 > -\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
355 >      sp->end (sp);\r
356 >  }\r
357 >  \r
358 > -#else /* GMIME_ATLEAST_26 */\r
359 > -\r
360 > -/* Get signature status string (GMime 2.4) */\r
361 > -static const char*\r
362 > -signer_status_to_string (GMimeSignerStatus x)\r
363 > -{\r
364 > -    switch (x) {\r
365 > -    case GMIME_SIGNER_STATUS_NONE:\r
366 > -     return "none";\r
367 > -    case GMIME_SIGNER_STATUS_GOOD:\r
368 > -     return "good";\r
369 > -    case GMIME_SIGNER_STATUS_BAD:\r
370 > -     return "bad";\r
371 > -    case GMIME_SIGNER_STATUS_ERROR:\r
372 > -     return "error";\r
373 > -    }\r
374 > -    return "unknown";\r
375 > -}\r
376 > -\r
377 > -/* Signature status sprinter (GMime 2.4) */\r
378 > -static void\r
379 > -format_part_sigstatus_sprinter (sprinter_t *sp, mime_node_t *node)\r
380 > -{\r
381 > -    const GMimeSignatureValidity* validity = node->sig_validity;\r
382 > -\r
383 > -    sp->begin_list (sp);\r
384 > -\r
385 > -    if (!validity) {\r
386 > -     sp->end (sp);\r
387 > -     return;\r
388 > -    }\r
389 > -\r
390 > -    const GMimeSigner *signer = g_mime_signature_validity_get_signers (validity);\r
391 > -    while (signer) {\r
392 > -     sp->begin_map (sp);\r
393 > -\r
394 > -     /* status */\r
395 > -     sp->map_key (sp, "status");\r
396 > -     sp->string (sp, signer_status_to_string (signer->status));\r
397 > -\r
398 > -     if (signer->status == GMIME_SIGNER_STATUS_GOOD)\r
399 > -     {\r
400 > -         if (signer->fingerprint) {\r
401 > -             sp->map_key (sp, "fingerprint");\r
402 > -             sp->string (sp, signer->fingerprint);\r
403 > -         }\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
409 > -         }\r
410 > -         if (signer->expires) {\r
411 > -             sp->map_key (sp, "expires");\r
412 > -             sp->integer (sp, signer->expires);\r
413 > -         }\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
421 > -             }\r
422 > -           }\r
423 > -       } else {\r
424 > -           if (signer->keyid) {\r
425 > -            sp->map_key (sp, "keyid");\r
426 > -            sp->string (sp, signer->keyid);\r
427 > -        }\r
428 > -       }\r
429 > -       if (signer->errors != GMIME_SIGNER_ERROR_NONE) {\r
430 > -        sp->map_key (sp, "errors");\r
431 > -        sp->integer (sp, signer->errors);\r
432 > -       }\r
433 > -\r
434 > -       sp->end (sp);\r
435 > -       signer = signer->next;\r
436 > -    }\r
437 > -\r
438 > -    sp->end (sp);\r
439 > -}\r
440 > -\r
441 > -#endif /* GMIME_ATLEAST_26 */\r
442 > -\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
446 > -- \r
447 > 2.5.0\r
448 >\r
449 > _______________________________________________\r
450 > notmuch mailing list\r
451 > notmuch@notmuchmail.org\r
452 > http://notmuchmail.org/mailman/listinfo/notmuch\r