Subject: bug#76655: 30.1; MH-E: "unseen" folder broken on OpenBSD

From: Mike Kupfer <[email-masked]>
Date: Fri, 28 Feb 2025 16:56:41 -0800

A user running 30.1 reported that when he runs mh-index-new-messages,
the resulting index folder (+mhe-index/sequence/unseen) does not list
the source folder(s) for the found messages.  The folder should look
something like

  +readLater/linux
    4  02/28 [Van Snyder     ]  Re: Hardware question
    6  02/28   [Greg Wooledge  ]  Re: Hardware question
    8 %02/28 [Salvatore Bonac]  [SECURITY] [DSA 5872-1] xorg-server security upda
  
  +readLater/misc
   22+t02/28 [Substack       ]  In-app video publishing, Notes stats, and a new t
   23 %02/28 [Palo Alto Farme]  Shop the Market, Support Our Community

But this user is missing the "+readLater/linux" and "+readLater/misc"
lines.

Furthermore, if the user views or deletes the message in the index
folder, a corresponding action is supposed to be performed on the
message in the source folder.  That's not happening.

Normally, messages in an MH-E index folder should have an
"X-MHE-Checksum" header line.  The user reports that those headers are
missing from the emails in the index folder.  MH-E uses this header to
tie the entry in the index folder to the entry in the source folder, so
their absence explains the above two problems.

The relevant code in MH-E is rather twisty, but it looks like the
headers are missing due to a bug in mh-index-sequenced-messages.  MH-E
calls out to an external program to compute the MD5 checksum for a
message.  mh-index-sequenced-messages sets
mh-search-next-result-function to mh-mairix-next-result, which
works if the external program is md5sum, which is what Linux users
usually get.

But the user reports that mh-checksum-cmd is set to invoke openssl,
and it looks like MH-E is unable to parse the openssl output.

The reason for using an external program are historical.  (These
problems are not a regression in Emacs 30.  The user also saw them with
Emacs 29.)  MH-E should get rid of the current framework
(mh-checksum-cmd, mh-checksum-parser, mh-checksum-choose, etc.) and just
use Emacs's md5 function.