--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id B327C6DE1435\r
+ for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 12:54:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.237\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.237 tagged_above=-999 required=5 tests=[AWL=-0.159,\r
+ SPF_NEUTRAL=0.652, URIBL_SBL=0.644, URIBL_SBL_A=0.1] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id ER95b4xdUcz4 for <notmuch@notmuchmail.org>;\r
+ Sun, 16 Aug 2015 12:54:48 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id A37B66DE142C\r
+ for <notmuch@notmuchmail.org>; Sun, 16 Aug 2015 12:54:47 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 46E9D1000E6;\r
+ Sun, 16 Aug 2015 22:53:36 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] cli/lib: remove support for GMime 2.4\r
+In-Reply-To: <1439739201-11068-1-git-send-email-david@tethera.net>\r
+References: <1439739201-11068-1-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.20.2+61~g367bd06 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sun, 16 Aug 2015 22:53:36 +0300\r
+Message-ID: <m2k2sv2enz.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 16 Aug 2015 19:54:50 -0000\r
+\r
+On Sun, Aug 16 2015, David Bremner <david@tethera.net> wrote:\r
+\r
+> It's becoming a maintenance burden to do anything things with the\r
+> crypto glue code twice, once for 2.4 and once for 2.6. I don't have\r
+> any 2.4 version available to test on my development machine anymore,\r
+> so the 2.4 specific code paths are likely not very well tested.\r
+> ---\r
+>\r
+> I started to rebase the SMIME signature verification patches and got\r
+> aggravated at solving the same conflicts twice in every file.\r
+>\r
+> 2.6.7 is from 2012, so that's a bit newer than some of our\r
+> requirements, but I think not so bad. YMMV.\r
+\r
+Perhaps it is time for me to update to gmime 2.6 in this machine. PITA ;/\r
+\r
+Tomi\r
+\r
+>\r
+> INSTALL | 6 ++--\r
+> configure | 49 ++++++++++-----------------------\r
+> crypto.c | 25 -----------------\r
+> mime-node.c | 83 -------------------------------------------------------\r
+> notmuch-show.c | 87 ----------------------------------------------------------\r
+> 5 files changed, 17 insertions(+), 233 deletions(-)\r
+>\r
+> diff --git a/INSTALL b/INSTALL\r
+> index eaccd93..b1b9cd5 100644\r
+> --- a/INSTALL\r
+> +++ b/INSTALL\r
+> @@ -20,7 +20,7 @@ configure stage.\r
+> \r
+> Dependencies\r
+> ------------\r
+> -Notmuch depends on four libraries: Xapian, GMime 2.4 or 2.6,\r
+> +Notmuch depends on four libraries: Xapian, GMime 2.6,\r
+> Talloc, and zlib which are each described below:\r
+> \r
+> Xapian\r
+> @@ -39,8 +39,8 @@ Talloc, and zlib which are each described below:\r
+> reading mail while notmuch would wait for Xapian when removing\r
+> the "inbox" and "unread" tags from messages in a thread.\r
+> \r
+> - GMime 2.4 or 2.6\r
+> - ----------------\r
+> + GMime 2.6\r
+> + ----------\r
+> GMime provides decoding of MIME email messages for Notmuch.\r
+> \r
+> Without GMime, Notmuch would not be able to extract and index\r
+> diff --git a/configure b/configure\r
+> index d289880..440d678 100755\r
+> --- a/configure\r
+> +++ b/configure\r
+> @@ -71,16 +71,6 @@ WITH_BASH=1\r
+> WITH_RUBY=1\r
+> WITH_ZSH=1\r
+> \r
+> -# Compatible GMime versions (with constraints).\r
+> -# If using GMime 2.6, we need to have a version >= 2.6.5 to avoid a\r
+> -# crypto bug. We need 2.6.7 for permissive "From " header handling.\r
+> -GMIME_24_VERSION_CTR=''\r
+> -GMIME_24_VERSION="gmime-2.4 $GMIME_24_VERSION_CTR"\r
+> -GMIME_26_VERSION_CTR='>= 2.6.7'\r
+> -GMIME_26_VERSION="gmime-2.6 $GMIME_26_VERSION_CTR"\r
+> -\r
+> -WITH_GMIME_VERSIONS="$GMIME_26_VERSION;$GMIME_24_VERSION"\r
+> -\r
+> usage ()\r
+> {\r
+> cat <<EOF\r
+> @@ -140,10 +130,6 @@ Fine tuning of some installation directories is available:\r
+> --bashcompletiondir=DIR Bash completions files [SYSCONFDIR/bash_completion.d]\r
+> --zshcompletiondir=DIR Zsh completions files [PREFIX/share/zsh/functions/Completion/Unix]\r
+> \r
+> -Some specific library versions can be specified (auto-detected otherwise):\r
+> -\r
+> - --with-gmime-version=VERS Specify GMIME version (2.4 or 2.6)\r
+> -\r
+> Some features can be disabled (--with-feature=no is equivalent to\r
+> --without-feature) :\r
+> \r
+> @@ -231,12 +217,6 @@ for option; do\r
+> fi\r
+> elif [ "${option}" = '--without-zsh-completion' ] ; then\r
+> WITH_ZSH=0\r
+> - elif [ "${option%%=*}" = '--with-gmime-version' ] ; then\r
+> - if [ "${option#*=}" = '2.4' ]; then\r
+> - WITH_GMIME_VERSIONS=$GMIME_24_VERSION\r
+> - elif [ "${option#*=}" = '2.6' ]; then\r
+> - WITH_GMIME_VERSIONS=$GMIME_26_VERSION\r
+> - fi\r
+> elif [ "${option%%=*}" = '--build' ] ; then\r
+> true\r
+> elif [ "${option%%=*}" = '--host' ] ; then\r
+> @@ -391,20 +371,19 @@ if [ ${have_xapian} = "1" ]; then\r
+> esac\r
+> fi\r
+> \r
+> +\r
+> +# we need to have a version >= 2.6.5 to avoid a crypto bug. We need\r
+> +# 2.6.7 for permissive "From " header handling.\r
+> +GMIME_MINVER=2.6.7\r
+> +\r
+> printf "Checking for GMime development files... "\r
+> -have_gmime=0\r
+> -IFS=';'\r
+> -for gmimepc in $WITH_GMIME_VERSIONS; do\r
+> - if pkg-config --exists $gmimepc; then\r
+> - printf "Yes ($gmimepc).\n"\r
+> - have_gmime=1\r
+> - gmime_cflags=$(pkg-config --cflags $gmimepc)\r
+> - gmime_ldflags=$(pkg-config --libs $gmimepc)\r
+> - break\r
+> - fi\r
+> -done\r
+> -IFS=$DEFAULT_IFS\r
+> -if [ "$have_gmime" = "0" ]; then\r
+> +if pkg-config --exists "gmime-2.6 >= $GMIME_MINVER"; then\r
+> + printf "Yes.\n"\r
+> + have_gmime=1\r
+> + gmime_cflags=$(pkg-config --cflags gmime-2.6)\r
+> + gmime_ldflags=$(pkg-config --libs gmime-2.6)\r
+> +else\r
+> + have_gmime=0\r
+> printf "No.\n"\r
+> errors=$((errors + 1))\r
+> fi\r
+> @@ -640,7 +619,7 @@ EOF\r
+> echo\r
+> fi\r
+> if [ $have_gmime -eq 0 ]; then\r
+> - echo " Either GMime 2.4 library" $GMIME_24_VERSION_CTR "or GMime 2.6 library" $GMIME_26_VERSION_CTR\r
+> + echo " GMime 2.6 library >= $GMIME_MINVER"\r
+> echo " (including development files such as headers)"\r
+> echo " http://spruce.sourceforge.net/gmime/"\r
+> echo\r
+> @@ -1026,7 +1005,7 @@ LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}\r
+> XAPIAN_CXXFLAGS = ${xapian_cxxflags}\r
+> XAPIAN_LDFLAGS = ${xapian_ldflags}\r
+> \r
+> -# Flags needed to compile and link against GMime-2.4\r
+> +# Flags needed to compile and link against GMime\r
+> GMIME_CFLAGS = ${gmime_cflags}\r
+> GMIME_LDFLAGS = ${gmime_ldflags}\r
+> \r
+> diff --git a/crypto.c b/crypto.c\r
+> index 026640f..a6eb27d 100644\r
+> --- a/crypto.c\r
+> +++ b/crypto.c\r
+> @@ -20,8 +20,6 @@\r
+> \r
+> #include "notmuch-client.h"\r
+> \r
+> -#ifdef GMIME_ATLEAST_26\r
+> -\r
+> /* Create a GPG context (GMime 2.6) */\r
+> static notmuch_crypto_context_t *\r
+> create_gpg_context (const char *gpgpath)\r
+> @@ -39,29 +37,6 @@ create_gpg_context (const char *gpgpath)\r
+> return gpgctx;\r
+> }\r
+> \r
+> -#else /* GMIME_ATLEAST_26 */\r
+> -\r
+> -/* Create a GPG context (GMime 2.4) */\r
+> -static notmuch_crypto_context_t *\r
+> -create_gpg_context (const char* gpgpath)\r
+> -{\r
+> - GMimeSession *session;\r
+> - notmuch_crypto_context_t *gpgctx;\r
+> -\r
+> - session = g_object_new (g_mime_session_get_type (), NULL);\r
+> - gpgctx = g_mime_gpg_context_new (session, gpgpath ? gpgpath : "gpg");\r
+> - g_object_unref (session);\r
+> -\r
+> - if (! gpgctx)\r
+> - return NULL;\r
+> -\r
+> - g_mime_gpg_context_set_always_trust ((GMimeGpgContext *) gpgctx, FALSE);\r
+> -\r
+> - return gpgctx;\r
+> -}\r
+> -\r
+> -#endif /* GMIME_ATLEAST_26 */\r
+> -\r
+> /* for the specified protocol return the context pointer (initializing\r
+> * if needed) */\r
+> notmuch_crypto_context_t *\r
+> diff --git a/mime-node.c b/mime-node.c\r
+> index fd9e4a4..e96e663 100644\r
+> --- a/mime-node.c\r
+> +++ b/mime-node.c\r
+> @@ -129,8 +129,6 @@ DONE:\r
+> return status;\r
+> }\r
+> \r
+> -#ifdef GMIME_ATLEAST_26\r
+> -\r
+> /* Signature list destructor (GMime 2.6) */\r
+> static int\r
+> _signature_list_free (GMimeSignatureList **proxy)\r
+> @@ -205,87 +203,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,\r
+> g_error_free (err);\r
+> }\r
+> \r
+> -#else /* GMIME_ATLEAST_26 */\r
+> -\r
+> -/* Signature validity destructor (GMime 2.4) */\r
+> -static int\r
+> -_signature_validity_free (GMimeSignatureValidity **proxy)\r
+> -{\r
+> - g_mime_signature_validity_free (*proxy);\r
+> - return 0;\r
+> -}\r
+> -\r
+> -/* Set up signature validity destructor (GMime 2.4) */\r
+> -static void\r
+> -set_signature_validity_destructor (mime_node_t *node,\r
+> - GMimeSignatureValidity *sig_validity)\r
+> -{\r
+> - GMimeSignatureValidity **proxy = talloc (node, GMimeSignatureValidity *);\r
+> - if (proxy) {\r
+> - *proxy = sig_validity;\r
+> - talloc_set_destructor (proxy, _signature_validity_free);\r
+> - }\r
+> -}\r
+> -\r
+> -/* Verify a signed mime node (GMime 2.4) */\r
+> -static void\r
+> -node_verify (mime_node_t *node, GMimeObject *part,\r
+> - notmuch_crypto_context_t *cryptoctx)\r
+> -{\r
+> - GError *err = NULL;\r
+> - GMimeSignatureValidity *sig_validity;\r
+> -\r
+> - node->verify_attempted = TRUE;\r
+> - sig_validity = g_mime_multipart_signed_verify\r
+> - (GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);\r
+> - node->sig_validity = sig_validity;\r
+> - if (sig_validity) {\r
+> - set_signature_validity_destructor (node, sig_validity);\r
+> - } else {\r
+> - fprintf (stderr, "Failed to verify signed part: %s\n",\r
+> - err ? err->message : "no error explanation given");\r
+> - }\r
+> -\r
+> - if (err)\r
+> - g_error_free (err);\r
+> -}\r
+> -\r
+> -/* Decrypt and optionally verify an encrypted mime node (GMime 2.4) */\r
+> -static void\r
+> -node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,\r
+> - notmuch_crypto_context_t *cryptoctx)\r
+> -{\r
+> - GError *err = NULL;\r
+> - GMimeMultipartEncrypted *encrypteddata = GMIME_MULTIPART_ENCRYPTED (part);\r
+> -\r
+> - node->decrypt_attempted = TRUE;\r
+> - node->decrypted_child = g_mime_multipart_encrypted_decrypt\r
+> - (encrypteddata, cryptoctx, &err);\r
+> - if (! node->decrypted_child) {\r
+> - fprintf (stderr, "Failed to decrypt part: %s\n",\r
+> - err ? err->message : "no error explanation given");\r
+> - goto DONE;\r
+> - }\r
+> -\r
+> - node->decrypt_success = TRUE;\r
+> - node->verify_attempted = TRUE;\r
+> -\r
+> - /* The GMimeSignatureValidity returned here is a const, unlike the\r
+> - * one returned by g_mime_multipart_signed_verify() in\r
+> - * node_verify() above, so the destructor is not needed.\r
+> - */\r
+> - node->sig_validity = g_mime_multipart_encrypted_get_signature_validity (encrypteddata);\r
+> - if (! node->sig_validity)\r
+> - fprintf (stderr, "Failed to verify encrypted signed part: %s\n",\r
+> - err ? err->message : "no error explanation given");\r
+> -\r
+> - DONE:\r
+> - if (err)\r
+> - g_error_free (err);\r
+> -}\r
+> -\r
+> -#endif /* GMIME_ATLEAST_26 */\r
+> -\r
+> static mime_node_t *\r
+> _mime_node_create (mime_node_t *parent, GMimeObject *part)\r
+> {\r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index b80933a..21015fd 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -334,8 +334,6 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out,\r
+> g_object_unref(stream_filter);\r
+> }\r
+> \r
+> -#ifdef GMIME_ATLEAST_26\r
+> -\r
+> /* Get signature status string (GMime 2.6) */\r
+> static const char*\r
+> signature_status_to_string (GMimeSignatureStatus x)\r
+> @@ -427,91 +425,6 @@ format_part_sigstatus_sprinter (sprinter_t *sp, mime_node_t *node)\r
+> sp->end (sp);\r
+> }\r
+> \r
+> -#else /* GMIME_ATLEAST_26 */\r
+> -\r
+> -/* Get signature status string (GMime 2.4) */\r
+> -static const char*\r
+> -signer_status_to_string (GMimeSignerStatus x)\r
+> -{\r
+> - switch (x) {\r
+> - case GMIME_SIGNER_STATUS_NONE:\r
+> - return "none";\r
+> - case GMIME_SIGNER_STATUS_GOOD:\r
+> - return "good";\r
+> - case GMIME_SIGNER_STATUS_BAD:\r
+> - return "bad";\r
+> - case GMIME_SIGNER_STATUS_ERROR:\r
+> - return "error";\r
+> - }\r
+> - return "unknown";\r
+> -}\r
+> -\r
+> -/* Signature status sprinter (GMime 2.4) */\r
+> -static void\r
+> -format_part_sigstatus_sprinter (sprinter_t *sp, mime_node_t *node)\r
+> -{\r
+> - const GMimeSignatureValidity* validity = node->sig_validity;\r
+> -\r
+> - sp->begin_list (sp);\r
+> -\r
+> - if (!validity) {\r
+> - sp->end (sp);\r
+> - return;\r
+> - }\r
+> -\r
+> - const GMimeSigner *signer = g_mime_signature_validity_get_signers (validity);\r
+> - while (signer) {\r
+> - sp->begin_map (sp);\r
+> -\r
+> - /* status */\r
+> - sp->map_key (sp, "status");\r
+> - sp->string (sp, signer_status_to_string (signer->status));\r
+> -\r
+> - if (signer->status == GMIME_SIGNER_STATUS_GOOD)\r
+> - {\r
+> - if (signer->fingerprint) {\r
+> - sp->map_key (sp, "fingerprint");\r
+> - sp->string (sp, signer->fingerprint);\r
+> - }\r
+> - /* these dates are seconds since the epoch; should we\r
+> - * provide a more human-readable format string? */\r
+> - if (signer->created) {\r
+> - sp->map_key (sp, "created");\r
+> - sp->integer (sp, signer->created);\r
+> - }\r
+> - if (signer->expires) {\r
+> - sp->map_key (sp, "expires");\r
+> - sp->integer (sp, signer->expires);\r
+> - }\r
+> - /* output user id only if validity is FULL or ULTIMATE. */\r
+> - /* note that gmime is using the term "trust" here, which\r
+> - * is WRONG. It's actually user id "validity". */\r
+> - if ((signer->name) && (signer->trust)) {\r
+> - if ((signer->trust == GMIME_SIGNER_TRUST_FULLY) || (signer->trust == GMIME_SIGNER_TRUST_ULTIMATE)) {\r
+> - sp->map_key (sp, "userid");\r
+> - sp->string (sp, signer->name);\r
+> - }\r
+> - }\r
+> - } else {\r
+> - if (signer->keyid) {\r
+> - sp->map_key (sp, "keyid");\r
+> - sp->string (sp, signer->keyid);\r
+> - }\r
+> - }\r
+> - if (signer->errors != GMIME_SIGNER_ERROR_NONE) {\r
+> - sp->map_key (sp, "errors");\r
+> - sp->integer (sp, signer->errors);\r
+> - }\r
+> -\r
+> - sp->end (sp);\r
+> - signer = signer->next;\r
+> - }\r
+> -\r
+> - sp->end (sp);\r
+> -}\r
+> -\r
+> -#endif /* GMIME_ATLEAST_26 */\r
+> -\r
+> static notmuch_status_t\r
+> format_part_text (const void *ctx, sprinter_t *sp, mime_node_t *node,\r
+> int indent, const notmuch_show_params_t *params)\r
+> -- \r
+> 2.5.0\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r