Re: [PATCH] cli: propagate NULL from _mime_node_create, handle it in callers.

Subject: Re: [PATCH] cli: propagate NULL from _mime_node_create, handle it in callers.

Date: Fri, 01 Sep 2017 20:32:16 +0000

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Jan Malakhovski


Hi.

David Bremner <david@tethera.net> writes:

> Can you check if this fixes the segfault for you? It's based on your
> patch, and your followup comment. It tries to handle all of the places
> mime_node_child is called.

It fixes segfaults the same way my patch does, but it also suffers from
the same problems.

It fixes the SIGSEGV, but, as with my patch, without some more code
around those NULLs `notmuch search --format=sexp --decrypt` simply
produces empty bodies (`:body ()`) for suspect messages. That breaks
rendering of those messages in `notmuch.el` (it fails with some
exception and stops rendering the rest of the thread; which is better
than rendering no messages in the thread, but still very far from
ideal). This solution also doesn't print any content when it could (in
case of an invalid signature).

Compiling with gmime-3.0.1, on the other hand, works perfectly. It just
shows that the signature is invalid and that's it, the rest of the
message and the rest of the thread renders perfectly. The problem with
gmime-3.0.1, as my other message still stuck in moderation shows, is
that a lot of other tests fail with some silly differences in the
produced JSONs.

Maybe its a bug in the tests. Maybe its a problem of `gmime` from
`nixpkgs` (apparently, it can't do pkcs7 and I didn't investigate why
yet). I'm not sure.

TBH, I would just `exit(1)` with an error like "your gmime is broken"
instead of producing NULLs whet gmime produces a NULL (to be
future-proof), assert non-NULL in all the other places, drop support for
gmime-2.6.*, require gmime-3.*, fix the tests (or `nixpkgs`) and get
happy.

Cheers,
  Jan
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: