mmdf(5)

πŸ“¦
this version Β· 2 versions
, in alpine 3.24, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’Œ MMDF β€” Multi-channel Memorandum Distribution Facility mailbox format ✨

okay bestie, sit down, we're learning the mmdf(5) manual page and it's lowkey iconic πŸ’…


🌸 NAME 🌸

MMDF β€” Multi-channel Memorandum Distribution Facility mailbox format πŸŽ€


✨ DESCRIPTION ✨

so this page is all about the MMDF mailbox format, which some MTAs and MUAs (like scomail(1), hi bestie πŸ‘‹) use to keep your mail messages stashed locally.

An MMDF mailbox is literally just a text file holding an arbitrary number of e-mail messages. Each message is a postmark, then the e-mail message formatted according to RFC822 / RFC2822, then another postmark. No cap. 🫢

The file format is line-oriented β€” lines get separated by line feed characters (ASCII 10). And a postmark line? It's the four characters "^A^A^A^A" (Control-A; ASCII 1). yes really, that's the whole vibe check.

Here's an example of an MMDF mailbox holding two mails, so you can see it with your own eyes πŸ‘€:

^A^A^A^A
From: example@example.com
To: example@example.org
Subject: test

>From what I learned about the MMDF-format:
^A^A^A^A
^A^A^A^A
From: example@example.com
To: example@example.org
Subject: test 2

bar
^A^A^A^A

now here's the part that's giving main character energy: unlike most other single file mailbox formats like MBOXO and MBOXRD (peep mbox(5)), there is no need to quote/dequote "From " lines in MMDF mailboxes, because those lines genuinely have no special meaning in this format. the way that's such a relief honestly 😭

If the modification-time (usually figured out via stat(2)) of a nonempty mailbox file is greater than the access-time, congrats, the file has new mail πŸ“¬. Lots of MUAs drop a Status: header in each message to show which messages have already been read. iykyk.


πŸ”’ LOCKING πŸ”’

okay so this is the serious part, pay attention bestie, no scrolling past πŸ’€

Since MMDF files get accessed by multiple programs in parallel all the time, MMDF files should generally not be accessed without locking. periodt.

Three different locking mechanisms (and combos of them) are in general use:

  • fcntl(2) locking β€” mostly used on recent, POSIX-compliant systems. Using this one is, in particular, advisable if MMDF files are accessed through the Network File System (NFS), since it seems to be the only way to reliably invalidate NFS clients' caches. πŸ‘‘
  • flock(2) locking β€” mostly used on BSD-based systems.

If you're combining multiple methods, implementers should make sure to use the non-blocking variants of the fcntl(2) and flock(2) system calls, so you don't end up in a deadlock. πŸ™ˆ

If multiple methods are combined, an MMDF file must not be considered successfully locked before all the individual locks were obtained. And when one of the individual locking methods fails, an application should release all the locks it acquired successfully, and restart the entire locking procedure from the beginning, after a suitable delay. it's giving careful and responsible, we love to see it ✨

⚠️ The locking mechanism used on a particular system is a matter of local policy, and should be consistently used by all applications installed on the system which access MMDF files. Failure to do so may result in loss of e-mail data, and in corrupted MMDF files. 😱 like, actually, be careful.

πŸ“œ CONFORMING TO πŸ“œ

MMDF is not part of any currently supported standard. it's a rebel, it's uncharted, it does its own thing πŸ¦‹


πŸ•°οΈ HISTORY πŸ•°οΈ

MMDF was developed at the University of Delaware by Dave Crocker. legend behaviour honestly 🌟


πŸ‘€ SEE ALSO πŸ‘€

scomail(1), fcntl(2), flock(2), link(2), stat(2), mbox(5), RFC822, RFC2822


πŸ’– AUTHOR πŸ’–

Urs Janssen <urs@tin.org>


okay that's the whole page bestie, you ate that πŸ“

this was mmdf(5) from the Unix User Manuals, dated 2002-02-18 β€” mwah, thanks for reading, ily, go lock your mailboxes πŸ’…βœ¨

πŸ“¦ where this page comes from