Re: [PATCH 09/16] gmime-cleanup: drop unused gmime #defines and simplify g_mime_init ()

2019-05-02 Thread David Bremner



this probably needs a more verbose commit message.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 01/16] gmime-cleanup: drop unused gmime 2.6 content_type from _index_encrypted_mime_part

2019-05-02 Thread David Bremner
Daniel Kahn Gillmor  writes:

> Signed-off-by: Daniel Kahn Gillmor 
> ---

I wouldn't mind a remark about the code movement in the commit message
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 03/16] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts

2019-05-02 Thread David Bremner
Daniel Kahn Gillmor  writes:

> Note that we do keep ignoring the gpg_path configuration option,
> though, to avoid breakage of existing installations.

This remark confused me a bit, since it doesn't seem to reference
anything in the patch. It's a consequence of our ignoring any unknown
configuration option, right?

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 08/16] gmime-cleanup: drop all unused GMimeCryptoContext arguments

2019-05-02 Thread David Bremner
Daniel Kahn Gillmor  writes:

> signed-off-by: Daniel Kahn Gillmor 
> ---
>  lib/index.cc   |  3 +--

it seemed like there is more than GMimeCryptoContext arguments being
dropped.

Maybe a more fulsome commit message?

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 12/16] gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects it

2019-05-02 Thread David Bremner


Because of the order of the diff, this looks a bit mysterious. Should
probably mention dropping the compat API
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 14/16] gmime-cleanup: no longer need to use GMime major version during build

2019-05-02 Thread David Bremner
Daniel Kahn Gillmor  writes:

> Signed-off-by: Daniel Kahn Gillmor 
> ---
>  configure | 4 
>  1 file changed, 4 deletions(-)

I think I'll squash this, and probably the next two into my initial
patch. Any objections?

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 14/16] gmime-cleanup: no longer need to use GMime major version during build

2019-05-02 Thread Daniel Kahn Gillmor
On Thu 2019-05-02 07:10:10 -0300, David Bremner wrote:
> Daniel Kahn Gillmor  writes:
>
>> Signed-off-by: Daniel Kahn Gillmor 
>> ---
>>  configure | 4 
>>  1 file changed, 4 deletions(-)
>
> I think I'll squash this, and probably the next two into my initial
> patch. Any objections?

squashing the next two into your initial commit, sure.  Squashing this
one won't work because it removes GMIME_MAJOR_VERSION entirely, which
breaks the test suite at least.  I think this needs to be the last of
the series.

--dkg


signature.asc
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 03/16] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts

2019-05-02 Thread Daniel Kahn Gillmor
On Thu 2019-05-02 06:50:41 -0300, David Bremner wrote:
> Daniel Kahn Gillmor  writes:
>
>> Note that we do keep ignoring the gpg_path configuration option,
>> though, to avoid breakage of existing installations.
>
> This remark confused me a bit, since it doesn't seem to reference
> anything in the patch. It's a consequence of our ignoring any unknown
> configuration option, right?

yes, i suppose that's true, though it's not exactly "unknown", since it
is documented as being ignored in crypto_config_comment in
notmuch-config.c.

--dkg
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 15/15] gmime-cleanup: no longer need to use GMime major version during build

2019-05-02 Thread Daniel Kahn Gillmor
Signed-off-by: Daniel Kahn Gillmor 
---
 configure | 4 
 1 file changed, 4 deletions(-)

diff --git a/configure b/configure
index 16bb0863..9140026a 100755
--- a/configure
+++ b/configure
@@ -497,7 +497,6 @@ if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then
 have_gmime=1
 gmime_cflags=$(pkg-config --cflags gmime-3.0)
 gmime_ldflags=$(pkg-config --libs gmime-3.0)
-gmime_major=3
 else
 have_gmime=0
 printf "No.\n"
@@ -1296,9 +1295,6 @@ NOTMUCH_RUBY=${RUBY}
 # building/testing ruby bindings.
 NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
 
-# Major version of gmime
-NOTMUCH_GMIME_MAJOR=${gmime_major}
-
 # Platform we are run on
 PLATFORM=${platform}
 EOF
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 10/15] gmime-cleanup: drop unused gmime #defines and simplify g_mime_init ()

2019-05-02 Thread Daniel Kahn Gillmor
Several of these #defines were not actually used in the notmuch
codebase any longer.  And as of GMime 3.0, g_mime_init takes no
arguments, so we can also drop the bogus RFC2047 argument that we were
passing and then #defining away.

signed-off-by: Daniel Kahn Gillmor 
---
 lib/database.cc| 2 +-
 lib/message-file.c | 2 +-
 notmuch.c  | 2 +-
 util/gmime-extra.h | 7 ---
 4 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/lib/database.cc b/lib/database.cc
index d2732f5e..1753117f 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -880,7 +880,7 @@ notmuch_database_open_verbose (const char *path,
 
 /* Initialize gmime */
 if (! initialized) {
-   g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+   g_mime_init ();
initialized = 1;
 }
 
diff --git a/lib/message-file.c b/lib/message-file.c
index ac5545b3..214f3c1d 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -135,7 +135,7 @@ _notmuch_message_file_parse (notmuch_message_file_t 
*message)
 is_mbox = _is_mbox (message->file);
 
 if (! initialized) {
-   g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+   g_mime_init ();
initialized = 1;
 }
 
diff --git a/notmuch.c b/notmuch.c
index de85041b..eeb794e8 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -463,7 +463,7 @@ main (int argc, char *argv[])
 
 local = talloc_new (NULL);
 
-g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
+g_mime_init ();
 #if !GLIB_CHECK_VERSION(2, 35, 1)
 g_type_init ();
 #endif
diff --git a/util/gmime-extra.h b/util/gmime-extra.h
index 60ae8765..e646efee 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,13 +9,8 @@ extern "C" {
 
 GMimeStream *g_mime_stream_stdout_new(void);
 
-#define GMIME_ENABLE_RFC_2047_WORKAROUNDS 0xdeadbeef
 #define g_mime_content_type_to_string(c) g_mime_content_type_get_mime_type (c)
 #define g_mime_filter_crlf_new(encode,dots) g_mime_filter_dos2unix_new (FALSE)
-#define g_mime_gpg_context_new(func,path) g_mime_gpg_context_new ()
-#define g_mime_gpg_context_set_use_agent(ctx,val) /*ignore*/
-#define g_mime_gpg_context_set_always_trust(ctx,val) /*ignore*/
-#define g_mime_init(flags) g_mime_init()
 #define g_mime_message_add_recipient(m,t,n,a) g_mime_message_add_mailbox 
(m,t,n,a)
 #define g_mime_message_set_subject(m,s) g_mime_message_set_subject(m,s,NULL)
 #define g_mime_multipart_signed_verify(mps,ctx,err) 
g_mime_multipart_signed_verify(mps, GMIME_ENCRYPT_NONE, err)
@@ -23,8 +18,6 @@ GMimeStream *g_mime_stream_stdout_new(void);
 #define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
 #define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, 
g_mime_parser_options_get_default ())
 #define g_mime_part_get_content_object(p) g_mime_part_get_content (p)
-#define g_mime_pkcs7_context_new(arg) g_mime_pkcs7_context_new()
-#define g_mime_pkcs7_context_set_always_trust(ctx,val) /*ignore*/
 #define g_mime_signature_get_errors(sig) g_mime_signature_get_status (sig)
 #define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text 
(NULL, txt)
 #define internet_address_to_string(ia,encode) internet_address_to_string 
(ia,NULL,encode)
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 09/15] gmime-cleanup: drop all arguments unused in GMime 3

2019-05-02 Thread Daniel Kahn Gillmor
This means dropping GMimeCryptoContext and notmuch_config arguments.

All the argument changes are to internal functions, so this is not an
API or ABI break.

We also get to drop the #define for g_mime_3_unused.

signed-off-by: Daniel Kahn Gillmor 
---
 lib/index.cc   |  3 +--
 mime-node.c| 13 +
 notmuch-client.h   |  2 +-
 notmuch-insert.c   |  2 +-
 notmuch-new.c  |  2 +-
 notmuch-reindex.c  |  2 +-
 notmuch.c  |  2 +-
 util/crypto.c  |  1 -
 util/crypto.h  |  1 -
 util/gmime-extra.h |  2 --
 10 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/lib/index.cc b/lib/index.cc
index 76830921..f21761d0 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -528,12 +528,11 @@ _index_encrypted_mime_part (notmuch_message_t *message,
 
 notmuch = notmuch_message_get_database (message);
 
-GMimeCryptoContext* crypto_ctx = NULL;
 bool attempted = false;
 GMimeDecryptResult *decrypt_result = NULL;
 bool get_sk = (notmuch_indexopts_get_decrypt_policy (indexopts) == 
NOTMUCH_DECRYPT_TRUE);
 clear = _notmuch_crypto_decrypt (&attempted, 
notmuch_indexopts_get_decrypt_policy (indexopts),
-message, crypto_ctx, encrypted_data, 
get_sk ? &decrypt_result : NULL, &err);
+message, encrypted_data, get_sk ? 
&decrypt_result : NULL, &err);
 if (!attempted)
return;
 if (err || !clear) {
diff --git a/mime-node.c b/mime-node.c
index 95dc5132..19744f43 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -170,8 +170,7 @@ set_signature_list_destructor (mime_node_t *node)
 
 /* Verify a signed mime node */
 static void
-node_verify (mime_node_t *node, GMimeObject *part,
-g_mime_3_unused(GMimeCryptoContext *cryptoctx))
+node_verify (mime_node_t *node, GMimeObject *part)
 {
 GError *err = NULL;
 
@@ -191,8 +190,7 @@ node_verify (mime_node_t *node, GMimeObject *part,
 
 /* Decrypt and optionally verify an encrypted mime node */
 static void
-node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
-g_mime_3_unused(GMimeCryptoContext *cryptoctx))
+node_decrypt_and_verify (mime_node_t *node, GMimeObject *part)
 {
 GError *err = NULL;
 GMimeDecryptResult *decrypt_result = NULL;
@@ -209,7 +207,7 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject 
*part,
node->decrypted_child = _notmuch_crypto_decrypt 
(&node->decrypt_attempted,
 
node->ctx->crypto->decrypt,
 message,
-cryptoctx, 
encrypteddata, &decrypt_result, &err);
+encrypteddata, 
&decrypt_result, &err);
 }
 if (! node->decrypted_child) {
fprintf (stderr, "Failed to decrypt part: %s\n",
@@ -249,7 +247,6 @@ static mime_node_t *
 _mime_node_create (mime_node_t *parent, GMimeObject *part)
 {
 mime_node_t *node = talloc_zero (parent, mime_node_t);
-GMimeCryptoContext *cryptoctx = NULL;
 
 /* Set basic node properties */
 node->part = part;
@@ -290,7 +287,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
 "message (must be exactly 2)\n",
 node->nchildren);
} else {
-   node_decrypt_and_verify (node, part, cryptoctx);
+   node_decrypt_and_verify (node, part);
}
 } else if (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify) {
if (node->nchildren != 2) {
@@ -299,7 +296,7 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
 "(must be exactly 2)\n",
 node->nchildren);
} else {
-   node_verify (node, part, cryptoctx);
+   node_verify (node, part);
}
 }
 
diff --git a/notmuch-client.h b/notmuch-client.h
index fba28242..d762d3cc 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -506,6 +506,6 @@ struct _notmuch_client_indexing_cli_choices {
 extern struct _notmuch_client_indexing_cli_choices indexing_cli_choices;
 extern const notmuch_opt_desc_t  notmuch_shared_indexing_options [];
 notmuch_status_t
-notmuch_process_shared_indexing_options (notmuch_database_t *notmuch, 
notmuch_config_t *config);
+notmuch_process_shared_indexing_options (notmuch_database_t *notmuch);
 
 #endif
diff --git a/notmuch-insert.c b/notmuch-insert.c
index d229c9dc..327470d4 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -550,7 +550,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, 
char *argv[])
 
 notmuch_exit_if_unmatched_db_uuid (notmuch);
 
-status = notmuch_process_shared_indexing_options (notmuch, config);
+status = notmuch_process_shared_indexing_options (notmuch);
 if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to process index options. (%s)\n",
 notmuch_status_t

[PATCH v2 14/15] gmime-cleanup: pass NULL as default GMimeParserOptions

2019-05-02 Thread Daniel Kahn Gillmor
This is a functional change, not a straight translation, because we
are no longer directly invoking g_mime_parser_options_get_default(),
but the GMime source has indicated that the options parameter for
g_mime_parser_construct_message() is "nullable" since upstream commit
d0ebdd2ea3e6fa635a2a551c846e9bc8b6040353 (which itself precedes GMime
3.0).

Signed-off-by: Daniel Kahn Gillmor 
---
 lib/message-file.c | 2 +-
 mime-node.c| 2 +-
 util/gmime-extra.h | 2 --
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index c507ee34..18802974 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -152,7 +152,7 @@ _notmuch_message_file_parse (notmuch_message_file_t 
*message)
 parser = g_mime_parser_new_with_stream (stream);
 g_mime_parser_set_scan_from (parser, is_mbox);
 
-message->message = g_mime_parser_construct_message (parser);
+message->message = g_mime_parser_construct_message (parser, NULL);
 if (! message->message) {
status = NOTMUCH_STATUS_FILE_NOT_EMAIL;
goto DONE;
diff --git a/mime-node.c b/mime-node.c
index 3fdf4808..cd3db67d 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -121,7 +121,7 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
goto DONE;
 }
 
-mctx->mime_message = g_mime_parser_construct_message (mctx->parser);
+mctx->mime_message = g_mime_parser_construct_message (mctx->parser, NULL);
 if (!mctx->mime_message) {
fprintf (stderr, "Failed to parse %s\n", filename);
status = NOTMUCH_STATUS_FILE_ERROR;
diff --git a/util/gmime-extra.h b/util/gmime-extra.h
index d2636b78..a42e43e7 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -9,8 +9,6 @@ extern "C" {
 
 GMimeStream *g_mime_stream_stdout_new(void);
 
-#define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, 
g_mime_parser_options_get_default ())
-
 /**
  * Get last 16 hex digits of fingerprint ("keyid")
  */
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 01/15] build: drop support for gmime-2.6

2019-05-02 Thread Daniel Kahn Gillmor
From: David Bremner 

GMime 3.0 is over 2 years old now, and 2.6 has been deprecated in
notmuch for about 1.5 years.

Comments and documentation no longer need to refer to GMime 2.6, so
clean them all up.

Signed-off-by: Daniel Kahn Gillmor 
---
 INSTALL |  2 +-
 configure   | 24 +---
 debian/control  |  2 +-
 mime-node.c |  8 
 notmuch-reply.c |  6 --
 notmuch-show.c  |  2 +-
 6 files changed, 12 insertions(+), 32 deletions(-)

diff --git a/INSTALL b/INSTALL
index 6e6f4799..f1236e71 100644
--- a/INSTALL
+++ b/INSTALL
@@ -20,7 +20,7 @@ configure stage.
 
 Dependencies
 
-Notmuch depends on four libraries: Xapian, GMime 2.6,
+Notmuch depends on four libraries: Xapian, GMime 3.0,
 Talloc, and zlib which are each described below:
 
Xapian
diff --git a/configure b/configure
index 5e7e5aa9..e6f33575 100755
--- a/configure
+++ b/configure
@@ -489,30 +489,16 @@ EOF
 rm -rf test.db _default_backend _default_backend.cc
 fi
 
-# we need to have a version >= 2.6.5 to avoid a crypto bug. We need
-# 2.6.7 for permissive "From " header handling.
-GMIME_MINVER=2.6.7
-GMIME3_MINVER=3.0.3
+GMIME_MINVER=3.0.3
 
 printf "Checking for GMime development files... "
-if pkg-config --exists "gmime-3.0 > $GMIME3_MINVER"; then
-printf "Yes (3.0).\n"
+if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then
+printf "Yes.\n"
 have_gmime=1
 gmime_cflags=$(pkg-config --cflags gmime-3.0)
 gmime_ldflags=$(pkg-config --libs gmime-3.0)
 gmime_major=3
 have_gmime_session_keys=1
-elif pkg-config --exists "gmime-2.6 >= $GMIME_MINVER"; then
-printf "Yes (2.6).\n"
-have_gmime=1
-gmime_cflags=$(pkg-config --cflags gmime-2.6)
-gmime_ldflags=$(pkg-config --libs gmime-2.6)
-gmime_major=2
-if pkg-config --exists "gmime-2.6 >= 2.6.21"; then
-have_gmime_session_keys=1
-else
-have_gmime_session_keys=0
-fi
 else
 have_gmime=0
 have_gmime_session_keys=0
@@ -788,7 +774,7 @@ EOF
echo
 fi
 if [ $have_gmime -eq 0 ]; then
-   echo "  GMime 2.6 library >= $GMIME_MINVER"
+   echo "  GMime library >= $GMIME_MINVER"
echo "  (including development files such as headers)"
echo "  https://github.com/jstedfast/gmime/";
echo
@@ -810,7 +796,7 @@ case a simple command will install everything you need. For 
example:
 
 On Debian and similar systems:
 
-   sudo apt-get install libxapian-dev libgmime-2.6-dev libtalloc-dev 
zlib1g-dev
+   sudo apt-get install libxapian-dev libgmime-3.0-dev libtalloc-dev 
zlib1g-dev
 
 Or on Fedora and similar systems:
 
diff --git a/debian/control b/debian/control
index 922f6d8c..31d6471c 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@ Build-Depends:
  debhelper (>= 11~),
  pkg-config,
  libxapian-dev,
- libgmime-3.0-dev (>= 3.0.3~) | libgmime-2.6-dev (>= 2.6.7~),
+ libgmime-3.0-dev (>= 3.0.3~),
  libtalloc-dev,
  libz-dev,
  python-all (>= 2.6.6-3~),
diff --git a/mime-node.c b/mime-node.c
index 1bfb479b..053f044a 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -149,7 +149,7 @@ DONE:
 return status;
 }
 
-/* Signature list destructor (GMime 2.6) */
+/* Signature list destructor */
 static int
 _signature_list_free (GMimeSignatureList **proxy)
 {
@@ -157,7 +157,7 @@ _signature_list_free (GMimeSignatureList **proxy)
 return 0;
 }
 
-/* Set up signature list destructor (GMime 2.6) */
+/* Set up signature list destructor */
 static void
 set_signature_list_destructor (mime_node_t *node)
 {
@@ -168,7 +168,7 @@ set_signature_list_destructor (mime_node_t *node)
 }
 }
 
-/* Verify a signed mime node (GMime 2.6) */
+/* Verify a signed mime node */
 static void
 node_verify (mime_node_t *node, GMimeObject *part,
 g_mime_3_unused(GMimeCryptoContext *cryptoctx))
@@ -189,7 +189,7 @@ node_verify (mime_node_t *node, GMimeObject *part,
g_error_free (err);
 }
 
-/* Decrypt and optionally verify an encrypted mime node (GMime 2.6) */
+/* Decrypt and optionally verify an encrypted mime node */
 static void
 node_decrypt_and_verify (mime_node_t *node, GMimeObject *part,
 g_mime_3_unused(GMimeCryptoContext *cryptoctx))
diff --git a/notmuch-reply.c b/notmuch-reply.c
index d87ec06d..cd1b602b 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -325,12 +325,6 @@ add_recipients_from_message (GMimeMessage *reply,
 GMimeMessage *message,
 bool reply_all)
 {
-
-/* There is a memory leak here with gmime-2.6 because get_sender
- * returns a newly allocated list, while the others return
- * references to libgmime owned data. This leak will be fixed with
- * the transition to gmime-3.0.
- */
 struct {
InternetAddressList * (*get_header)(GMimeMessage *message);
GMimeRecipientType recipient_type;
diff --git a/notmuch-show.c b/notmuch-show.c
index 88699e90..4ed5ff2b 100644
--- a/notmuch-show.c
+++ b/n

[PATCH v2 06/15] gmime-cleanup: tests should only care about gmime 3

2019-05-02 Thread Daniel Kahn Gillmor
note that "notmuch-show for message with invalid From" is still broken
in T310-emacs.sh.  It would be good to debug what's going on there and
try to get it fixed!

signed-off-by: Daniel Kahn Gillmor 
---
 test/T190-multipart.sh |  2 --
 test/T310-emacs.sh |  2 +-
 test/T350-crypto.sh|  2 --
 test/test-lib.sh   | 16 
 4 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
index 9ad141cb..5cfa9d33 100755
--- a/test/T190-multipart.sh
+++ b/test/T190-multipart.sh
@@ -489,7 +489,6 @@ notmuch show --format=raw --part=0 
'id:87liy5ap00@yoom.home.cworth.org' >OUT
 test_expect_equal_file "${MAIL_DIR}"/multipart OUTPUT
 
 test_begin_subtest "--format=raw --part=1, message body"
-test_subtest_broken_gmime_2
 notmuch show --format=raw --part=1 'id:87liy5ap00@yoom.home.cworth.org' 
>OUTPUT
 test_expect_equal_file multipart_body OUTPUT
 
@@ -543,7 +542,6 @@ notmuch show --format=raw --part=3 
'id:87liy5ap00@yoom.home.cworth.org' >OUT
 test_expect_equal_file embedded_message OUTPUT
 
 test_begin_subtest "--format=raw --part=4, rfc822's multipart"
-test_subtest_broken_gmime_2
 notmuch show --format=raw --part=4 'id:87liy5ap00@yoom.home.cworth.org' 
>OUTPUT
 test_expect_equal_file embedded_message_body OUTPUT
 
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index cb9e99a5..c06a8133 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -86,7 +86,7 @@ test_emacs "(let ((notmuch-show-indent-messages-width 4))
 test_expect_equal_file 
$EXPECTED/notmuch-show-thread-maildir-storage-with-fourfold-indentation OUTPUT
 
 test_begin_subtest "notmuch-show for message with invalid From"
-test_subtest_broken_gmime_3
+test_subtest_known_broken
 add_message "[subject]=\"message-with-invalid-from\"" \
"[from]=\"\\\"Invalid \\\" From\\\" \""
 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
index 2f793e96..6045a7dc 100755
--- a/test/T350-crypto.sh
+++ b/test/T350-crypto.sh
@@ -136,7 +136,6 @@ test_expect_equal_json \
 "$expected"
 
 test_begin_subtest "signature verification with full owner trust"
-test_subtest_broken_gmime_2
 # give the key full owner trust
 echo "${FINGERPRINT}:6:" | gpg --no-tty --import-ownertrust 
>>"$GNUPGHOME"/trust.log 2>&1
 gpg --no-tty --check-trustdb >>"$GNUPGHOME"/trust.log 2>&1
@@ -347,7 +346,6 @@ test_expect_success \
 "(mml-secure-message-sign-encrypt)"'
 
 test_begin_subtest "decryption + signature verification"
-test_subtest_broken_gmime_2
 output=$(notmuch show --format=json --decrypt=true subject:"test encrypted 
message 002" \
 | notmuch_json_show_sanitize \
 | sed -e 's|"created": [1234567890]*|"created": 946728000|')
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 58909ee7..04d93f7d 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1079,22 +1079,6 @@ TEST_DIRECTORY=$NOTMUCH_BUILDDIR/test
 
 . "$NOTMUCH_SRCDIR/test/test-lib-common.sh" || exit 1
 
-if [ "${NOTMUCH_GMIME_MAJOR}" = 3 ]; then
-test_subtest_broken_gmime_3 () {
-   test_subtest_known_broken
-}
-test_subtest_broken_gmime_2 () {
-   true
-}
-else
-test_subtest_broken_gmime_3 () {
-   true
-}
-test_subtest_broken_gmime_2 () {
-   test_subtest_known_broken
-}
-fi
-
 emacs_generate_script
 
 
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 02/15] gmime-cleanup: drop unused gmime 2.6 content_type from _index_encrypted_mime_part

2019-05-02 Thread Daniel Kahn Gillmor
In _index_mime_part, we don't need to extract the content-type from
the part until just before we use it, so we also defer it lazily.

Signed-off-by: Daniel Kahn Gillmor 
---
 lib/index.cc | 22 +-
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/lib/index.cc b/lib/index.cc
index efd9da4c..0e98984c 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -367,7 +367,6 @@ _index_content_type (notmuch_message_t *message, 
GMimeObject *part)
 
 static void
 _index_encrypted_mime_part (notmuch_message_t *message, notmuch_indexopts_t 
*indexopts,
-   GMimeContentType *content_type,
GMimeMultipartEncrypted *part);
 
 /* Callback to generate terms for each mime part of a message. */
@@ -392,7 +391,6 @@ _index_mime_part (notmuch_message_t *message,
 }
 
 _index_content_type (message, part);
-content_type = g_mime_object_get_content_type (part);
 
 if (GMIME_IS_MULTIPART (part)) {
GMimeMultipart *multipart = GMIME_MULTIPART (part);
@@ -421,7 +419,6 @@ _index_mime_part (notmuch_message_t *message,
 g_mime_multipart_get_part (multipart, i));
if (i == GMIME_MULTIPART_ENCRYPTED_CONTENT) {
_index_encrypted_mime_part(message, indexopts,
-  content_type,
   GMIME_MULTIPART_ENCRYPTED 
(part));
} else {
if (i != GMIME_MULTIPART_ENCRYPTED_VERSION) {
@@ -476,6 +473,7 @@ _index_mime_part (notmuch_message_t *message,
 
 filter = g_mime_stream_filter_new (stream);
 
+content_type = g_mime_object_get_content_type (part);
 discard_non_term_filter = notmuch_filter_discard_non_term_new 
(content_type);
 
 g_mime_stream_filter_add (GMIME_STREAM_FILTER (filter),
@@ -518,7 +516,6 @@ _index_mime_part (notmuch_message_t *message,
 static void
 _index_encrypted_mime_part (notmuch_message_t *message,
notmuch_indexopts_t *indexopts,
-   g_mime_3_unused(GMimeContentType *content_type),
GMimeMultipartEncrypted *encrypted_data)
 {
 notmuch_status_t status;
@@ -532,23 +529,6 @@ _index_encrypted_mime_part (notmuch_message_t *message,
 notmuch = notmuch_message_get_database (message);
 
 GMimeCryptoContext* crypto_ctx = NULL;
-#if (GMIME_MAJOR_VERSION < 3)
-{
-   const char *protocol = NULL;
-   protocol = g_mime_content_type_get_parameter (content_type, "protocol");
-   status = _notmuch_crypto_get_gmime_ctx_for_protocol 
(&(indexopts->crypto),
-protocol, &crypto_ctx);
-   if (status) {
-   _notmuch_database_log (notmuch, "Warning: setup failed for 
decrypting "
-  "during indexing. (%d)\n", status);
-   status = notmuch_message_add_property (message, "index.decryption", 
"failure");
-   if (status)
-   _notmuch_database_log_append (notmuch, "failed to add 
index.decryption "
- "property (%d)\n", status);
-   return;
-   }
-}
-#endif
 bool attempted = false;
 GMimeDecryptResult *decrypt_result = NULL;
 bool get_sk = (HAVE_GMIME_SESSION_KEYS && 
notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 12/15] gmime-cleanup: use GMime 3.0 function names

2019-05-02 Thread Daniel Kahn Gillmor
Signed-off-by: Daniel Kahn Gillmor 
---
 lib/index.cc   |  4 ++--
 notmuch-reply.c|  8 
 notmuch-show.c | 16 
 util/gmime-extra.h |  4 
 4 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/lib/index.cc b/lib/index.cc
index f21761d0..41822488 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -357,7 +357,7 @@ _index_content_type (notmuch_message_t *message, 
GMimeObject *part)
 {
 GMimeContentType *content_type = g_mime_object_get_content_type (part);
 if (content_type) {
-   char *mime_string = g_mime_content_type_to_string (content_type);
+   char *mime_string = g_mime_content_type_get_mime_type (content_type);
if (mime_string) {
_notmuch_message_gen_terms (message, "mimetype", mime_string);
g_free (mime_string);
@@ -493,7 +493,7 @@ _index_mime_part (notmuch_message_t *message,
}
 }
 
-wrapper = g_mime_part_get_content_object (GMIME_PART (part));
+wrapper = g_mime_part_get_content (GMIME_PART (part));
 if (wrapper)
g_mime_data_wrapper_write_to_stream (wrapper, filter);
 
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 48fdbc92..62ec176f 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -75,10 +75,10 @@ format_part_reply (GMimeStream *stream, mime_node_t *node)
   GMIME_DISPOSITION_ATTACHMENT) == 0) {
const char *filename = g_mime_part_get_filename (GMIME_PART 
(node->part));
g_mime_stream_printf (stream, "Attachment: %s (%s)\n", filename,
- g_mime_content_type_to_string (content_type));
+ g_mime_content_type_get_mime_type 
(content_type));
} else {
g_mime_stream_printf (stream, "Non-text part: %s\n",
- g_mime_content_type_to_string (content_type));
+ g_mime_content_type_get_mime_type 
(content_type));
}
 }
 
@@ -209,7 +209,7 @@ scan_address_list (InternetAddressList *list,
if (user_from && *user_from == NULL)
*user_from = addr;
} else if (message) {
-   g_mime_message_add_recipient (message, type, name, addr);
+   g_mime_message_add_mailbox (message, type, name, addr);
n++;
}
}
@@ -367,7 +367,7 @@ add_recipients_from_message (GMimeMessage *reply,
  * of recipients so that the reply goes back to the user.
  */
 if (n == 0 && from_addr)
-   g_mime_message_add_recipient (reply, GMIME_ADDRESS_TYPE_TO, NULL, 
from_addr);
+   g_mime_message_add_mailbox (reply, GMIME_ADDRESS_TYPE_TO, NULL, 
from_addr);
 
 return from_addr;
 }
diff --git a/notmuch-show.c b/notmuch-show.c
index dc587108..c897591c 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -278,14 +278,14 @@ show_text_part_content (GMimeObject *part, GMimeStream 
*stream_out,
 
 if (! g_mime_content_type_is_type (content_type, "text", "*"))
INTERNAL_ERROR ("Illegal request to format non-text part (%s) as text.",
-   g_mime_content_type_to_string (content_type));
+   g_mime_content_type_get_mime_type (content_type));
 
 if (stream_out == NULL)
return;
 
 charset = g_mime_object_get_content_type_parameter (part, "charset");
 charset = charset ? g_mime_charset_canon_name (charset) : NULL;
-wrapper = g_mime_part_get_content_object (GMIME_PART (part));
+wrapper = g_mime_part_get_content (GMIME_PART (part));
 if (wrapper && charset && !g_ascii_strncasecmp (charset, "iso-8859-", 9)) {
GMimeStream *null_stream = NULL;
GMimeStream *null_stream_filter = NULL;
@@ -309,7 +309,7 @@ show_text_part_content (GMimeObject *part, GMimeStream 
*stream_out,
 }
 
 stream_filter = g_mime_stream_filter_new (stream_out);
-crlf_filter = g_mime_filter_crlf_new (false, false);
+crlf_filter = g_mime_filter_dos2unix_new (false);
 g_mime_stream_filter_add(GMIME_STREAM_FILTER (stream_filter),
 crlf_filter);
 g_object_unref (crlf_filter);
@@ -524,7 +524,7 @@ format_part_text (const void *ctx, sprinter_t *sp, 
mime_node_t *node,
if (cid)
g_mime_stream_printf (stream, ", Content-id: %s", cid);
 
-   content_string = g_mime_content_type_to_string (content_type);
+   content_string = g_mime_content_type_get_mime_type (content_type);
g_mime_stream_printf (stream, ", Content-type: %s\n", content_string);
g_free (content_string);
 }
@@ -566,7 +566,7 @@ format_part_text (const void *ctx, sprinter_t *sp, 
mime_node_t *node,
{
show_text_part_content (node->part, stream, 0);
} else {
-   char *content_string = g_mime_content_type_to_string (content_type);
+   char *content_string = g_mime_content_type_get_mime_type 
(content_type);
g_mime_stream_printf (stream, "Non-text par

[PATCH v2 13/15] gmime-cleanup: pass NULL arguments explicitly where GMime 3.0 expects it

2019-05-02 Thread Daniel Kahn Gillmor
Several GMime 2.6 functions sprouted a change in the argument order in
GMime 3.0.  We had a compatibility layer here to be able to handle
compiling against both GMime 2.6 and 3.0.  Now that we're using 3.0
only, rip out the compatibility layer for those functions with changed
argument lists, and explicitly use the 3.0 argument lists.

Signed-off-by: Daniel Kahn Gillmor 
---
 lib/message-file.c |  4 ++--
 lib/thread.cc  |  2 +-
 mime-node.c|  2 +-
 notmuch-reply.c| 10 +-
 notmuch-search.c   |  4 ++--
 notmuch-show.c |  4 ++--
 util/gmime-extra.h |  7 ---
 7 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index 214f3c1d..c507ee34 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -212,7 +212,7 @@ static char *
 _extend_header (char *combined, const char *value) {
 char *decoded;
 
-decoded = g_mime_utils_header_decode_text (value);
+decoded = g_mime_utils_header_decode_text (NULL, value);
 if (! decoded) {
if (combined) {
g_free (combined);
@@ -296,7 +296,7 @@ _notmuch_message_file_get_header (notmuch_message_file_t 
*message,
value = g_mime_object_get_header (GMIME_OBJECT (message->message),
  header);
if (value)
-   decoded = g_mime_utils_header_decode_text (value);
+   decoded = g_mime_utils_header_decode_text (NULL, value);
else
decoded = g_strdup ("");
 }
diff --git a/lib/thread.cc b/lib/thread.cc
index 47c90664..c9c9398f 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -284,7 +284,7 @@ _thread_add_message (notmuch_thread_t *thread,
 
 from = notmuch_message_get_header (message, "from");
 if (from)
-   list = internet_address_list_parse_string (from);
+   list = internet_address_list_parse (NULL, from);
 
 if (list) {
address = internet_address_list_get_address (list, 0);
diff --git a/mime-node.c b/mime-node.c
index 19744f43..3fdf4808 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -176,7 +176,7 @@ node_verify (mime_node_t *node, GMimeObject *part)
 
 node->verify_attempted = true;
 node->sig_list = g_mime_multipart_signed_verify
-   (GMIME_MULTIPART_SIGNED (part), cryptoctx, &err);
+   (GMIME_MULTIPART_SIGNED (part), GMIME_ENCRYPT_NONE, &err);
 
 if (node->sig_list)
set_signature_list_destructor (node);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 62ec176f..7f284229 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -28,7 +28,7 @@ static void
 show_reply_headers (GMimeStream *stream, GMimeMessage *message)
 {
 /* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */
-if (g_mime_object_write_to_stream (GMIME_OBJECT(message), stream) < 0) {
+if (g_mime_object_write_to_stream (GMIME_OBJECT(message), NULL, stream) < 
0) {
INTERNAL_ERROR("failed to write headers to stdout\n");
 }
 }
@@ -541,7 +541,7 @@ create_reply_message(void *ctx,
 in_reply_to = talloc_asprintf (ctx, "<%s>",
   notmuch_message_get_message_id (message));
 
-g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", 
in_reply_to);
+g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", 
in_reply_to, NULL);
 
 orig_references = notmuch_message_get_header (message, "references");
 if (orig_references && *orig_references)
@@ -550,7 +550,7 @@ create_reply_message(void *ctx,
 else
references = talloc_strdup (ctx, in_reply_to);
 
-g_mime_object_set_header (GMIME_OBJECT (reply), "References", references);
+g_mime_object_set_header (GMIME_OBJECT (reply), "References", references, 
NULL);
 
 from_addr = add_recipients_from_message (reply, config,
 mime_message, reply_all);
@@ -589,13 +589,13 @@ create_reply_message(void *ctx,
 from_addr = talloc_asprintf (ctx, "%s <%s>",
 notmuch_config_get_user_name (config),
 from_addr);
-g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr);
+g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr, NULL);
 
 subject = notmuch_message_get_header (message, "subject");
 if (subject) {
if (strncasecmp (subject, "Re:", 3))
subject = talloc_asprintf (ctx, "Re: %s", subject);
-   g_mime_message_set_subject (reply, subject);
+   g_mime_message_set_subject (reply, subject, NULL);
 }
 
 return reply;
diff --git a/notmuch-search.c b/notmuch-search.c
index 8f467db4..e2dee418 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -364,7 +364,7 @@ print_mailbox (const search_context_t *ctx, const mailbox_t 
*mailbox)
 
 /* name_addr has the name part quoted if necessary. Compare
  * 'John Doe ' vs. '"Doe, John" ' */
-name_addr = internet_address_to_string (ia, false);
+name_addr = internet_address_to_string (ia, NULL, fa

[PATCH v2 07/15] gmime-cleanup: simplify T355-smime.sh

2019-05-02 Thread Daniel Kahn Gillmor
GMime 3.0 and later can handle User ID as expected.

signed-off-by: Daniel Kahn Gillmor 
---
 test/T355-smime.sh | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/test/T355-smime.sh b/test/T355-smime.sh
index be45e3b1..e410286b 100755
--- a/test/T355-smime.sh
+++ b/test/T355-smime.sh
@@ -48,12 +48,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "signature verification (notmuch CLI)"
-if [ "${NOTMUCH_GMIME_MAJOR}" -lt 3 ]; then
-# gmime 2 can't report User IDs properly for S/MIME
-USERID=''
-else
-USERID='"userid": "CN=Notmuch Test Suite",'
-fi
 output=$(notmuch show --format=json --verify subject:"test signed message 001" 
\
 | notmuch_json_show_sanitize \
 | sed -e 's|"created": [-1234567890]*|"created": 946728000|' \
@@ -71,7 +65,8 @@ expected='[[[{"id": "X",
  "Date": "Sat, 01 Jan 2000 12:00:00 +"},
  "body": [{"id": 1,
  "sigstatus": [{"fingerprint": "'$FINGERPRINT'",
- "status": "good",'$USERID'
+ "status": "good",
+ "userid": "CN=Notmuch Test Suite",
  "expires": 424242424,
  "created": 946728000}],
  "content-type": "multipart/signed",
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 11/15] gmime-cleanup: use GMime 3.0 data types

2019-05-02 Thread Daniel Kahn Gillmor
Signed-off-by: Daniel Kahn Gillmor 
---
 notmuch-reply.c|  4 ++--
 notmuch-show.c |  8 
 util/gmime-extra.h | 11 +++
 3 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index fa91c5de..48fdbc92 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -176,7 +176,7 @@ static unsigned int
 scan_address_list (InternetAddressList *list,
   notmuch_config_t *config,
   GMimeMessage *message,
-  GMimeRecipientType type,
+  GMimeAddressType type,
   const char **user_from)
 {
 InternetAddress *address;
@@ -325,7 +325,7 @@ add_recipients_from_message (GMimeMessage *reply,
 {
 struct {
InternetAddressList * (*get_header)(GMimeMessage *message);
-   GMimeRecipientType recipient_type;
+   GMimeAddressType recipient_type;
 } reply_to_map[] = {
{ get_sender,   GMIME_ADDRESS_TYPE_TO },
{ get_to,   GMIME_ADDRESS_TYPE_TO },
diff --git a/notmuch-show.c b/notmuch-show.c
index 730a91f8..dc587108 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -363,13 +363,13 @@ signature_status_to_string (GMimeSignatureStatus status)
 
 /* Print signature flags */
 struct key_map_struct {
-GMimeSignatureError bit;
+GMimeSignatureStatus bit;
 const char * string;
 };
 
 static void
 do_format_signature_errors (sprinter_t *sp, struct key_map_struct *key_map,
-   unsigned int array_map_len, GMimeSignatureError 
errors) {
+   unsigned int array_map_len, GMimeSignatureStatus 
errors) {
 sp->map_key (sp, "errors");
 sp->begin_map (sp);
 
@@ -386,7 +386,7 @@ do_format_signature_errors (sprinter_t *sp, struct 
key_map_struct *key_map,
 static void
 format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
 {
-GMimeSignatureError errors = g_mime_signature_get_errors (signature);
+GMimeSignatureStatus errors = g_mime_signature_get_status (signature);
 
 if (!(errors & GMIME_SIGNATURE_STATUS_ERROR_MASK))
return;
@@ -465,7 +465,7 @@ format_part_sigstatus_sprinter (sprinter_t *sp, 
GMimeSignatureList *siglist)
}
 
if (notmuch_format_version <= 3) {
-   GMimeSignatureError errors = g_mime_signature_get_errors 
(signature);
+   GMimeSignatureStatus errors = g_mime_signature_get_status 
(signature);
if (g_mime_signature_status_error (errors)) {
sp->map_key (sp, "errors");
sp->integer (sp, errors);
diff --git a/util/gmime-extra.h b/util/gmime-extra.h
index e646efee..a183952d 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -18,15 +18,10 @@ GMimeStream *g_mime_stream_stdout_new(void);
 #define g_mime_object_set_header(o,h,v) g_mime_object_set_header (o,h,v,NULL)
 #define g_mime_parser_construct_message(p) g_mime_parser_construct_message (p, 
g_mime_parser_options_get_default ())
 #define g_mime_part_get_content_object(p) g_mime_part_get_content (p)
-#define g_mime_signature_get_errors(sig) g_mime_signature_get_status (sig)
 #define g_mime_utils_header_decode_text(txt) g_mime_utils_header_decode_text 
(NULL, txt)
 #define internet_address_to_string(ia,encode) internet_address_to_string 
(ia,NULL,encode)
 #define internet_address_list_parse_string(str) internet_address_list_parse 
(NULL,str)
 
-typedef GMimeAddressType GMimeRecipientType;
-
-typedef GMimeSignatureStatus GMimeSignatureError;
-
 /**
  * Get last 16 hex digits of fingerprint ("keyid")
  */
@@ -35,9 +30,9 @@ const char *g_mime_certificate_get_fpr16 (GMimeCertificate 
*cert);
  * Return the contents of the appropriate address header as a string
  * Should be freed using g_free
  */
-char *g_mime_message_get_address_string (GMimeMessage *message, 
GMimeRecipientType type);
+char *g_mime_message_get_address_string (GMimeMessage *message, 
GMimeAddressType type);
 
-InternetAddressList * g_mime_message_get_addresses (GMimeMessage *message, 
GMimeRecipientType type);
+InternetAddressList * g_mime_message_get_addresses (GMimeMessage *message, 
GMimeAddressType type);
 
 /**
  * return talloc allocated date string
@@ -71,7 +66,7 @@ gboolean g_mime_signature_status_good (GMimeSignatureStatus 
status);
 
 gboolean g_mime_signature_status_bad (GMimeSignatureStatus status);
 
-gboolean g_mime_signature_status_error (GMimeSignatureError status);
+gboolean g_mime_signature_status_error (GMimeSignatureStatus status);
 
 gint64 g_mime_utils_header_decode_date_unix (const char *date);
 
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 08/15] gmime-cleanup: drop g_mime_2_6_unref

2019-05-02 Thread Daniel Kahn Gillmor
signed-off-by: Daniel Kahn Gillmor 
---
 lib/index.cc   | 1 -
 notmuch-reply.c| 2 --
 util/gmime-extra.h | 1 -
 3 files changed, 4 deletions(-)

diff --git a/lib/index.cc b/lib/index.cc
index 6b6fbb8f..76830921 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -591,7 +591,6 @@ _notmuch_message_index_file (notmuch_message_t *message,
 addresses = g_mime_message_get_from (mime_message);
 if (addresses) {
_index_address_list (message, "from", addresses);
-   g_mime_2_6_unref (addresses);
 }
 
 addresses = g_mime_message_get_all_recipients (mime_message);
diff --git a/notmuch-reply.c b/notmuch-reply.c
index 974df401..fa91c5de 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -285,8 +285,6 @@ static InternetAddressList *get_sender(GMimeMessage 
*message)
 */
if (! reply_to_header_is_redundant (message, reply_to_list))
return reply_to_list;
-
-   g_mime_2_6_unref (G_OBJECT (reply_to_list));
 }
 
 return g_mime_message_get_from (message);
diff --git a/util/gmime-extra.h b/util/gmime-extra.h
index d539ec3a..c17fa8fb 100644
--- a/util/gmime-extra.h
+++ b/util/gmime-extra.h
@@ -34,7 +34,6 @@ typedef GMimeAddressType GMimeRecipientType;
 
 typedef GMimeSignatureStatus GMimeSignatureError;
 
-#define g_mime_2_6_unref(obj) /*ignore*/
 #define g_mime_3_unused(arg) unused(arg)
 
 /**
-- 
2.20.1

___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v2 03/15] gmime-cleanup: remove GMime 2.6 variant codeblocks

2019-05-02 Thread Daniel Kahn Gillmor
signed-off-by: Daniel Kahn Gillmor 
---
 lib/message-file.c | 42 -
 notmuch-show.c | 21 ---
 util/gmime-extra.c | 93 --
 util/gmime-extra.h | 12 --
 4 files changed, 168 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index 8f0dbbda..ac5545b3 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -238,47 +238,6 @@ _extend_header (char *combined, const char *value) {
 return combined;
 }
 
-#if (GMIME_MAJOR_VERSION < 3)
-static char *
-_notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
-  const char *header)
-{
-GMimeHeaderList *headers;
-GMimeHeaderIter *iter;
-char *combined = NULL;
-
-headers = g_mime_object_get_header_list (GMIME_OBJECT (message->message));
-if (! headers)
-   return NULL;
-
-iter = g_mime_header_iter_new ();
-if (! iter)
-   return NULL;
-
-if (! g_mime_header_list_get_iter (headers, iter))
-   goto DONE;
-
-do {
-   const char *value;
-   if (strcasecmp (g_mime_header_iter_get_name (iter), header) != 0)
-   continue;
-
-   /* Note that GMime retains ownership of value... */
-   value = g_mime_header_iter_get_value (iter);
-
-   combined = _extend_header (combined, value);
-} while (g_mime_header_iter_next (iter));
-
-/* Return empty string for non-existing headers. */
-if (! combined)
-   combined = g_strdup ("");
-
-  DONE:
-g_mime_header_iter_free (iter);
-
-return combined;
-}
-#else
 static char *
 _notmuch_message_file_get_combined_header (notmuch_message_file_t *message,
   const char *header)
@@ -310,7 +269,6 @@ _notmuch_message_file_get_combined_header 
(notmuch_message_file_t *message,
 
 return combined;
 }
-#endif
 
 const char *
 _notmuch_message_file_get_header (notmuch_message_file_t *message,
diff --git a/notmuch-show.c b/notmuch-show.c
index 4ed5ff2b..ad7cf122 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -383,26 +383,6 @@ do_format_signature_errors (sprinter_t *sp, struct 
key_map_struct *key_map,
 sp->end (sp);
 }
 
-#if (GMIME_MAJOR_VERSION < 3)
-static void
-format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
-{
-GMimeSignatureError errors = g_mime_signature_get_errors (signature);
-
-if (errors == GMIME_SIGNATURE_ERROR_NONE)
-   return;
-
-struct key_map_struct key_map[] = {
-   { GMIME_SIGNATURE_ERROR_EXPSIG, "sig-expired" },
-   { GMIME_SIGNATURE_ERROR_NO_PUBKEY, "key-missing"},
-   { GMIME_SIGNATURE_ERROR_EXPKEYSIG, "key-expired"},
-   { GMIME_SIGNATURE_ERROR_REVKEYSIG, "key-revoked"},
-   { GMIME_SIGNATURE_ERROR_UNSUPP_ALGO, "alg-unsupported"},
-};
-
-do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
-}
-#else
 static void
 format_signature_errors (sprinter_t *sp, GMimeSignature *signature)
 {
@@ -425,7 +405,6 @@ format_signature_errors (sprinter_t *sp, GMimeSignature 
*signature)
 
 do_format_signature_errors (sp, key_map, ARRAY_SIZE(key_map), errors);
 }
-#endif
 
 /* Signature status sprinter */
 static void
diff --git a/util/gmime-extra.c b/util/gmime-extra.c
index bc1e3c4d..4b577a5b 100644
--- a/util/gmime-extra.c
+++ b/util/gmime-extra.c
@@ -31,97 +31,6 @@ g_string_talloc_strdup (void *ctx, char *g_string)
 return new_str;
 }
 
-#if (GMIME_MAJOR_VERSION < 3)
-
-const char *
-g_mime_certificate_get_valid_userid (GMimeCertificate *cert)
-{
-/* output user id only if validity is FULL or ULTIMATE. */
-/* note that gmime 2.6 is using the term "trust" here, which
- * is WRONG.  It's actually user id "validity". */
-const char *name = g_mime_certificate_get_name (cert);
-if (name == NULL)
-   return name;
-GMimeCertificateTrust trust = g_mime_certificate_get_trust (cert);
-if (trust == GMIME_CERTIFICATE_TRUST_FULLY || trust == 
GMIME_CERTIFICATE_TRUST_ULTIMATE)
-   return name;
-return NULL;
-}
-
-char *
-g_mime_message_get_address_string (GMimeMessage *message, GMimeRecipientType 
type)
-{
-InternetAddressList *list = g_mime_message_get_recipients (message, type);
-return internet_address_list_to_string (list, 0);
-}
-
-inline InternetAddressList *
-g_mime_message_get_addresses (GMimeMessage *message, GMimeRecipientType type)
-{
-return g_mime_message_get_recipients (message, type);
-}
-
-char *
-g_mime_message_get_date_string (void *ctx, GMimeMessage *message)
-{
-char *date = g_mime_message_get_date_as_string (message);
-return g_string_talloc_strdup (ctx, date);
-}
-
-InternetAddressList *
-g_mime_message_get_from (GMimeMessage *message)
-{
-return internet_address_list_parse_string (g_mime_message_get_sender 
(message));
-}
-
-const char *
-g_mime_message_get_from_string (GMimeMessage *message) {
-return  g_mime_message_get_sender (message);
-}
-
-InternetAddressList *
-g_mime_mess

[PATCH v2 04/15] gmime-cleanup: remove obsolete gpg_path configuration option and crypto contexts

2019-05-02 Thread Daniel Kahn Gillmor
Note that we do keep ignoring the gpg_path configuration option,
though, to avoid breakage of existing installations.  It is ignored
like any other unknown configuration option, but we at least document
that it is ignored so that people who find it in their legacy configs
can know that it's safe to drop.

signed-off-by: Daniel Kahn Gillmor 
---
 mime-node.c |  16 --
 notmuch-client.h|   9 
 notmuch-config.c|  29 ---
 notmuch-reply.c |   4 --
 notmuch-show.c  |   4 --
 notmuch.c   |   8 ---
 test/T030-config.sh |   7 +--
 test/T040-setup.sh  |   6 ---
 util/crypto.c   | 118 
 util/crypto.h   |  12 -
 10 files changed, 1 insertion(+), 212 deletions(-)

diff --git a/mime-node.c b/mime-node.c
index 053f044a..a8005f70 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -284,22 +284,6 @@ _mime_node_create (mime_node_t *parent, GMimeObject *part)
return NULL;
 }
 
-#if (GMIME_MAJOR_VERSION < 3)
-if ((GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt != 
NOTMUCH_DECRYPT_FALSE))
-   || (GMIME_IS_MULTIPART_SIGNED (part) && node->ctx->crypto->verify)) {
-   GMimeContentType *content_type = g_mime_object_get_content_type (part);
-   const char *protocol = g_mime_content_type_get_parameter (content_type, 
"protocol");
-   notmuch_status_t status;
-   status = _notmuch_crypto_get_gmime_ctx_for_protocol (node->ctx->crypto,
-protocol, 
&cryptoctx);
-   if (status) /* this is a warning, not an error */
-   fprintf (stderr, "Warning: %s (%s).\n", notmuch_status_to_string 
(status),
-protocol ? protocol : "NULL");
-   if (!cryptoctx)
-   return node;
-}
-#endif
-
 /* Handle PGP/MIME parts */
 if (GMIME_IS_MULTIPART_ENCRYPTED (part) && (node->ctx->crypto->decrypt != 
NOTMUCH_DECRYPT_FALSE)) {
if (node->nchildren != 2) {
diff --git a/notmuch-client.h b/notmuch-client.h
index 6c84ecc0..fba28242 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -276,15 +276,6 @@ void
 notmuch_config_set_database_path (notmuch_config_t *config,
  const char *database_path);
 
-#if (GMIME_MAJOR_VERSION < 3)
-const char *
-notmuch_config_get_crypto_gpg_path (notmuch_config_t *config);
-
-void
-notmuch_config_set_crypto_gpg_path (notmuch_config_t *config,
- const char *gpg_path);
-#endif
-
 const char *
 notmuch_config_get_user_name (notmuch_config_t *config);
 
diff --git a/notmuch-config.c b/notmuch-config.c
index bf77cc9d..e029e306 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -104,19 +104,11 @@ static const char search_config_comment[] =
 static const char crypto_config_comment[] =
 " Cryptography related configuration\n"
 "\n"
-#if (GMIME_MAJOR_VERSION < 3)
-" The following *deprecated* option is currently supported:\n"
-"\n"
-"\tgpg_path\n"
-"\t\tbinary name or full path to invoke gpg.\n"
-"\t\tNOTE: In a future build, this option will be ignored.\n"
-#else
 " The following old option is now ignored:\n"
 "\n"
 "\tgpgpath\n"
 "\t\tThis option was used by older builds of notmuch to choose\n"
 "\t\tthe version of gpg to use.\n"
-#endif
 "\t\tSetting $PATH is a better approach.\n";
 
 struct _notmuch_config {
@@ -470,12 +462,6 @@ notmuch_config_open (void *ctx,
g_error_free (error);
 }
 
-#if (GMIME_MAJOR_VERSION < 3)
-if (notmuch_config_get_crypto_gpg_path (config) == NULL) {
-   notmuch_config_set_crypto_gpg_path (config, "gpg");
-}
-#endif
-
 /* Whenever we know of configuration sections that don't appear in
  * the configuration file, we add some comments to help the user
  * understand what can be done. */
@@ -776,21 +762,6 @@ notmuch_config_set_search_exclude_tags (notmuch_config_t 
*config,
  &(config->search_exclude_tags));
 }
 
-#if (GMIME_MAJOR_VERSION < 3)
-const char *
-notmuch_config_get_crypto_gpg_path (notmuch_config_t *config)
-{
-return _config_get (config, &config->crypto_gpg_path, "crypto", 
"gpg_path");
-}
-
-void
-notmuch_config_set_crypto_gpg_path (notmuch_config_t *config,
- const char *gpg_path)
-{
-_config_set (config, &config->crypto_gpg_path, "crypto", "gpg_path", 
gpg_path);
-}
-#endif
-
 
 /* Given a configuration item of the form . return the
  * component group and key. If any error occurs, print a message on
diff --git a/notmuch-reply.c b/notmuch-reply.c
index cd1b602b..974df401 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -748,10 +748,6 @@ notmuch_reply_command (notmuch_config_t *config, int argc, 
char *argv[])
return EXIT_FAILURE;
 }
 
-#if (GMIME_MAJOR_VERSION < 3)
-params.crypto.gpgpath = notmuch_config_get_crypto_gpg_path (config);
-#endif
-
 if (notmuch_database_open (notmuch_config_get_data

[PATCH v2 05/15] gmime-cleanup: always support session keys

2019-05-02 Thread Daniel Kahn Gillmor
Our minimum version of GMime 3.0 always supports good session key
handling.

signed-off-by: Daniel Kahn Gillmor 
---
 configure |  9 -
 lib/built-with.c  |  2 +-
 lib/index.cc  |  4 +---
 mime-node.c   |  2 --
 notmuch-show.c|  2 --
 test/T357-index-decryption.sh | 18 --
 util/crypto.c | 18 --
 7 files changed, 2 insertions(+), 53 deletions(-)

diff --git a/configure b/configure
index e6f33575..16bb0863 100755
--- a/configure
+++ b/configure
@@ -498,10 +498,8 @@ if pkg-config --exists "gmime-3.0 > $GMIME_MINVER"; then
 gmime_cflags=$(pkg-config --cflags gmime-3.0)
 gmime_ldflags=$(pkg-config --libs gmime-3.0)
 gmime_major=3
-have_gmime_session_keys=1
 else
 have_gmime=0
-have_gmime_session_keys=0
 printf "No.\n"
 errors=$((errors + 1))
 fi
@@ -1160,9 +1158,6 @@ HAVE_TIMEGM = ${have_timegm}
 # Whether struct dirent has d_type (if not, then notmuch will use stat)
 HAVE_D_TYPE = ${have_d_type}
 
-# Whether the GMime version can handle extraction and reuse of session keys
-HAVE_GMIME_SESSION_KEYS = ${have_gmime_session_keys}
-
 # Whether the Xapian version in use supports compaction
 HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
 
@@ -1249,7 +1244,6 @@ COMMON_CONFIGURE_CFLAGS = \\
-DHAVE_D_TYPE=\$(HAVE_D_TYPE)   \\
-DSTD_GETPWUID=\$(STD_GETPWUID) \\
-DSTD_ASCTIME=\$(STD_ASCTIME)   \\
-   -DHAVE_GMIME_SESSION_KEYS=\$(HAVE_GMIME_SESSION_KEYS)   \\
-DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)   \\
-DSILENCE_XAPIAN_DEPRECATION_WARNINGS   \\
-DHAVE_XAPIAN_FIELD_PROCESSOR=\$(HAVE_XAPIAN_FIELD_PROCESSOR) \\
@@ -1278,9 +1272,6 @@ 
NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR=${have_xapian_field_processor}
 # Whether the Xapian version in use supports lock retry
 NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${have_xapian_db_retry_lock}
 
-# Whether the GMime version can handle extraction and reuse of session keys
-NOTMUCH_HAVE_GMIME_SESSION_KEYS=${have_gmime_session_keys}
-
 # Which backend will Xapian use by default?
 NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}
 
diff --git a/lib/built-with.c b/lib/built-with.c
index 9cffd9f9..320be6c5 100644
--- a/lib/built-with.c
+++ b/lib/built-with.c
@@ -31,7 +31,7 @@ notmuch_built_with (const char *name)
 } else if (STRNCMP_LITERAL (name, "retry_lock") == 0) {
return HAVE_XAPIAN_DB_RETRY_LOCK;
 } else if (STRNCMP_LITERAL (name, "session_key") == 0) {
-   return HAVE_GMIME_SESSION_KEYS;
+   return true;
 } else {
return false;
 }
diff --git a/lib/index.cc b/lib/index.cc
index 0e98984c..6b6fbb8f 100644
--- a/lib/index.cc
+++ b/lib/index.cc
@@ -531,7 +531,7 @@ _index_encrypted_mime_part (notmuch_message_t *message,
 GMimeCryptoContext* crypto_ctx = NULL;
 bool attempted = false;
 GMimeDecryptResult *decrypt_result = NULL;
-bool get_sk = (HAVE_GMIME_SESSION_KEYS && 
notmuch_indexopts_get_decrypt_policy (indexopts) == NOTMUCH_DECRYPT_TRUE);
+bool get_sk = (notmuch_indexopts_get_decrypt_policy (indexopts) == 
NOTMUCH_DECRYPT_TRUE);
 clear = _notmuch_crypto_decrypt (&attempted, 
notmuch_indexopts_get_decrypt_policy (indexopts),
 message, crypto_ctx, encrypted_data, 
get_sk ? &decrypt_result : NULL, &err);
 if (!attempted)
@@ -554,7 +554,6 @@ _index_encrypted_mime_part (notmuch_message_t *message,
return;
 }
 if (decrypt_result) {
-#if HAVE_GMIME_SESSION_KEYS
if (get_sk) {
status = notmuch_message_add_property (message, "session-key",
   
g_mime_decrypt_result_get_session_key (decrypt_result));
@@ -562,7 +561,6 @@ _index_encrypted_mime_part (notmuch_message_t *message,
_notmuch_database_log (notmuch, "failed to add session-key "
   "property (%d)\n", status);
}
-#endif
g_object_unref (decrypt_result);
 }
 _index_mime_part (message, indexopts, clear);
diff --git a/mime-node.c b/mime-node.c
index a8005f70..95dc5132 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -228,7 +228,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject 
*part,
set_signature_list_destructor (node);
}
 
-#if HAVE_GMIME_SESSION_KEYS
if (node->ctx->crypto->decrypt == NOTMUCH_DECRYPT_TRUE && message) {
notmuch_database_t *db = notmuch_message_get_database (message);
const char *session_key = g_mime_decrypt_result_get_session_key 
(decrypt_result);
@@ -238,7 +237,6 @@ node_decrypt_and_verify (mime_node_t *node, GMimeObject 
*part,
  notmuch_message_add_property (message, 
"session-key",

session_key))

Two "latest" releases available for download

2019-05-02 Thread Ralph Seichter
I just realised that https://notmuchmail.org/releases/ holds both
LATEST-notmuch-0.28.2.tar.gz and LATEST-notmuch-0.28.3.tar.gz, which
seems to be one "latest" too many?

-Ralph
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Two "latest" releases available for download

2019-05-02 Thread David Bremner
Ralph Seichter  writes:

> I just realised that https://notmuchmail.org/releases/ holds both
> LATEST-notmuch-0.28.2.tar.gz and LATEST-notmuch-0.28.3.tar.gz, which
> seems to be one "latest" too many?

fixed, thanks.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] build: drop support for gmime-2.6

2019-05-02 Thread Rollins, Jameson
>>> I was thinking of a minimal change now, so it isn't blocking other
>>> things, and then a gradual cleanup.
>>
>> just go for it.
>
> You mean this patch, or the other more extensive patch that someone (TM)
> has to write?

Go for the full cleanup all at once.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] build: drop support for gmime-2.6

2019-05-02 Thread Rollins, Jameson
On Wed, May 01 2019, David Bremner  wrote:
> I was thinking of a minimal change now, so it isn't blocking other
> things, and then a gradual cleanup.

just go for it.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch