nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] What OS/Architecture Do You Run nmh On?

2018-02-16 20:08:16
Is there a  documented pros/cons discussion of MH  mailstore vs Maildir.
They  do have  similar structures  in that  a Maildir  stores individual
messages in individual files. I've often wondered what I might gain from
switching to  Maildir (it's benefits  are clear with respect  to locking
and crash prevention).

Here are my thoughts:

In the MH mailstore, the filename IS the message identifier.  This is
a kind of double-edged sword; this means you don't need to maintain a
mapping from message identifiers to filenames.  This means there are no
issues with caching; it's all maintained by the filesystem.  This is
very simple and leverages the Unix filesystem very nicely.

But ... with a few exceptions, it is NOT safe to run two MH programs
at the same time.  Because no one ever expected that to happen, no one
ever sat down and specified exactly how you are supposed to add a message
to a MH folder, so third-party implementations aren't guaranteed to
do it the same way.  And in stock MH (and for a long time in nmh) you could
get sequence file corruption, because no one ever did locking on sequence
files (we fixed that).

In Maildir, the filenames mostly only have the property that they have
to be unique.  The filenames do have a little bit of optional metadata
in them that some programs use (see Dovecot for a richer example).  So
you have to maintain a mapping from message identifiers to filenames.
But, it's well defined how to add messages to those mailboxes, so as
long as you maintain your own mapping namespace you can use multiple
tools without problems.

So, which one is better?  Well, what do you want, exactly?

Oh, regarding a previous discussion ... here's why I was leaning towards
Maildir being more of a mail drop than a mail box.  From:

    http://www.qmail.org/qmail-manual-html/man5/maildir.html

INTRODUCTION
     maildir is a structure for directories of incoming mail mes-
     sages.   It solves the reliability problems that plague mbox
     files and mh folders.

It just says "structure for directories of incoming mail messages".
However, that document is incorrect; if you are using rcvstore(1) to
deliver a message to a MH folder from your MTA directly, it first writes
it into a tmp file and then uses link() to hard link it to the "correct"
name (and if two files try to use the same name, whomever loses the race
will end up with the next highest message number, so no mail will be
lost nor should there ever be corruption).

--Ken

-- 
Nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>