mddiff(1)
π mddiff(1) β the maildir diff bestie π
Sync Mail Dir (smd) documentation π yes we're doing the smd family today, and today's main character is mddiff.
β¨ NAME β¨
mddiff β computes diff for maildirs π¦
πΈ SYNOPSIS πΈ
mddiff [--max-mailno mno] [--db-file dbf] [-l|--list] [-s|--symlink]
[--exclude globexpr] [-v|--verbose] [-d|--dry-run]
[-n|--no-delete] [--no-move] [--help] [--sha1sum] paths
π DESCRIPTION π
okay so here's the tea π«: mddiff computes the delta between an old status of a maildir (one that was previously recorded in a support file, aka the db file) and the current status. Out comes a set of commands β a diff, literally β that some third party software can apply to synchronize a (possibly remote, iykyk) copy of that maildir. iconic behaviour fr fr π
If paths is a single file name, and that file is a fifo, then mddiff reads file names from it, separated by newline, and outputs the sha1 of its header and body separated by a space. no cap β¨
$ mddiff /tmp/fifo_for_mddiff
806a0ffe4f29766effd764... 463e543da9dac8e298...
582cbb6a5cd3ce13965c8c... 8fa60a7458b1157193...
...
If paths is a single file name, and that file is a fifo, and the -s option is passed, mddiff reads from that fifo two lines at a time β first a source name, then a target name. Then it creates a symlink named as the target name, pointing to the source name πͺ. If some directories need to be created in order to create that symlink, that gets done too. mddiff prints 'OK' on stdout to signal a success, and 'ERROR' to signal an error. slay π
If paths is a list of directories, mddiff outputs a list of actions that a client has to perform to synchronize a copy of those same maildirs. This set of actions is relative to a previous status of the maildir, the one stored in the db file π. The input directories get traversed recursively, and every file encountered inside directories named cur/ and new/ is a potential mail message β unless it contains no \n\n, in which case it is skipped. noted bestie, it's giving β¨selectiveβ¨
$ mddiff ~/Mail/
ADD ~/Mail/cur/1239038050.14937_1.garfield:2,S 66532ebb05b252e...
...
Every client (meaning: every endpoint that uses mddiff for synchronization) must use a different db-file. the way that the db-file is strictly related to the set of directories you pass as argumentsβ¦ it should not be used with a different directory set π¨. Adding items to the directory set is safe π, but removing them may not do what you want β delete actions get generated, and that's a whole situation π
mddiff does not alter the dbf file. It generates a new one called dbf.new. It's up to the higher level tool smd-server(1) to rename dbf.new to dbf, but only in case the other endpoint successfully applied the diff. so don't go renaming things yourself, mkay π
The --exclude option tells mddiff to ignore all paths matching the given glob(7) expression. You can pass this option multiple times π. Matching is performed using fnmatch(3) with no special flags, so '*' and '?' match any character including '/'. Matching happens when a directory is entered. If the match is successful, that directory and all its subdirectories are skipped. bye felicia π
The --no-delete option tells mddiff to not output a DELETE action for files that disappear. But heads up π«Ά: a DELETE action is anyway generated for files that are moved (i.e. move is COPY plus DELETE). The result is that deletions are not propagated to the other endpoint. periodt.
π OPTIONS π
--max-mailno mnoβ estimation of max mail message number (defaults to the number of messages in the db-file + 1000, or 500000 if there is no db-file). You may want to decrease it for the first run on small systems. It is anyway increased automatically when needed π--db-file dbfβ name of the cache for the endpoint (defaultdb.txt) ποΈ--exclude globexprβ exclude paths matching the given expression π«--sha1sumβ behaves like thesha1sumutility π--mkdir-pβ behaves likemkdir -pπ--mkfifoβ behaves likemkfifoπ§΅-l,--listβ only list the mailboxes recursively contained inpathsπ-s,--symlinkβ create symlinks for paths read on the input fifo π-v,--verboseβ increase program verbosity (printed on stderr) π£οΈ-d,--dry-runβ do not generate a new db-file π-n,--no-deleteβ do not track deleted files π«₯--no-moveβ do not generateMOVE(onlyCOPY+DELETE) π--helpβ this help screen π
π¦ NOTES π¦
mddiff is a low level utility, used by smd-server and smd-client. You should use higher level tools like smd-pull(1), smd-push(1) and smd-loop(1) β let the big sisters handle it bestie, they got you π«Ά
π SEE ALSO π
smd-client(1), smd-server(1), smd-pull(1), smd-push(1), smd-loop(1)
π AUTHOR π
Enrico Tassi <gares@fettunta.org> π
okay that's the whole page, and as a lil sign-off: this one's from the Sync Mail Dir (smd) docs, dated 21 April 2021, and it's mddiff(1) β go forth and diff those maildirs, bestie π
β¨π
π¦ where this page comes from
- ubuntu jammy: syncmaildir 1.3.0-1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms