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

Jan Malakhovski oxij at oxij.org
Fri Sep 1 13:32:16 PDT 2017


Hi.

David Bremner <david at 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


More information about the notmuch mailing list