[PATCH 2/3] notmuch-mutt: support for messages that lack Message-ID headers

Stefano Zacchiroli zack at upsilon.cc
Sat Jan 24 07:21:06 PST 2015


First of all thanks for your feedback, Jani!
(both here, and the other day on IRC, of course)

On Sat, Jan 24, 2015 at 04:59:16PM +0200, Jani Nikula wrote:
> On Sat, 24 Jan 2015, Stefano Zacchiroli <zack at upsilon.cc> wrote:
> >
> > For those messages, compute a synthetic Message-ID based on the SHA1
> > of the whole message, in the same way that notmuch would do. See:
> > http://git.notmuchmail.org/git/notmuch/blob/HEAD:/lib/sha1.c
> 
> As I said on IRC, I think this is a notmuch implementation detail, and
> we don't make any promises about always generating missing message-ids
> the same way. That said, I don't see any reason why we'd change this
> anytime soon, so the solution is probably good enough for now.

ACK. I've noted down the code URL in the patch for reference, and also
as a warning to keep an eye on.

> > To do the above, rewrite get_message_id() to scan the current message
> > line by line, incrementally computing a SHA1. As a consequence, drop
> > the dependency on Mail::Internet.
> 
> I am not so sure this is a good idea however, see below.

So, fun part here is that I had initially made a similar comment to Jan.
Then got convinced to do as the current patch does to avoid loading full
messages (potentially with large attachments and the like) in memory.

But I didn't think of header folding, and you're absolutely correct in
saying that might be a problem.

I've just found out Mail::Header->new which I believe solves both
problems: avoid loading the full message into memory (it will only load
the headers) and proper parsing folded Message-IDs, without having to
use more complex regexp hackery.

Jan: do you agree with using Mail::Header->new and fall back to
line-by-line hasing only in case Message-ID is not found? If so, having
an updated patch based on the one I've posted here would be awesome! If
you cannot do that just let me know and I'll get to it, eventually :).

Cheers.
-- 
Stefano Zacchiroli  . . . . . . .  zack at upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Former Debian Project Leader  . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »


More information about the notmuch mailing list