dotlock(1)
π dotlock β bestie edition π
okay so real quick, this is the manual for dotlock, which is the page you're reading, but the actual program it's yapping about is called mutt_dotlock. same vibe, one is the page name, one is the thing you type. iykyk β¨
πΈ NAME πΈ
mutt_dotlock β locks mail spool files. that's it. that's the job. she's a lock girlie and she's booked and busy π
π¦ SYNOPSIS π¦
mutt_dotlock [-t|-f|-u|-d] [-p] [-r retries] file
β¨ DESCRIPTION β¨
okay so mutt_dotlock does the traditional mail spool file locking method, the old-school one, no cap. here's the tea:
to lock file, she creates a file named file.lock. that's the whole ritual. and if she needs to, she operates with group mail privileges β like, she'll put on the group-mail-privileges outfit if the situation calls for it π
π OPTIONS π
-tβ just try. she will not actually lock file, she's just peeking π β she'll tell whoever invoked her whether it's at all possible to lock file. window shopping, essentially.-fβ force the lock. if some other process has been holding a lock on file for longer than a certain amount of time,mutt_dotlockwill break that lock by removing the lockfile. she said move π«Ά-uβ unlock. she removesfile.lock. bye bestie π¨-dβ delete. she locks file, removes it if it has length0, and afterwards removesfile.lock. full cleanup arc.-pβ use privileges. if you give her this one,mutt_dotlockwill operate with group mail privileges when creating and deleting lock files.-rretries β this one tellsmutt_dotlockto try locking retries times before giving up, or β if she was invoked with the-foption β before breaking a lock. the default value is5. and between each successive locking attempt,mutt_dotlockwaits one second. so like, she's patient but she's not that patient.
π FILES π
file.lockβ the lock file thatmutt_dotlockgenerates. iconic, honestly.
π SEE ALSO π
fcntl(2), flock(2), lockfile(1), mutt(1)
go read those too, they're all part of the lore π
π DIAGNOSTICS π
mutt_dotlock says everything she needs to say through her return values. no small talk, just numbers:
0βDL_EX_OKβ the program was successful. we love a win π1βDL_EX_ERRORβ an unspecified error has occurred, like bad command line parameters, lack of system memory, and the like. vague, mysterious, unhelpful π3βDL_EX_EXISTβ the user wants to lock a file which has already been locked by another process. and ifmutt_dotlockwas invoked with the-fcommand line option, she won't generate this error β instead she'll break other processes' locks. so rude, so necessary.4βDL_EX_NEED_RPIVSβ this return value only happens ifmutt_dotlockwas invoked with the-tcommand line option. it means she will have to use her group mail privileges to lock file.5βDL_EX_IMPOSSIBLEβ this return value also only happens ifmutt_dotlockwas invoked with the-tcommand line option. it means she is unable to lock file even with group mail privileges. truly the flop era π
π§ NOTES π§
mutt_dotlock tries to implement an NFS-safe dotlocking method, which was borrowed from lockfile (1). respectfully, credit given π
β οΈ okay this one's important: if the user can't open file for reading with their normal privileges,mutt_dotlockwill return theDL_EX_ERRORexit value β this is on purpose, to avoid certain attacks against other users' spool files. the code carefully avoids race conditions when checking permissions; for all the details of that, see the comments indotlock.c. do not come for her security choices, she's thought about this.
π HISTORY π
mutt_dotlock is part of the Mutt mail user agent package. she was created to avoid running mutt with group mail privileges. a queen who solved a problem before it was even a problem π
π AUTHOR π
Thomas Roessler <roessler@does-not-exist.org>
and that's the whole page, bestie π«Ά this came out of the Unix manual set, AUGUST 1999 β yes, 1999, she's vintage and still slaying, and the page itself is dotlock(1). periodt. π
β¨
π¦ where this page comes from
- debian bookworm: mutt 2.2.12-0.1~deb12u1 Β· GPL-2.0-or-later
- debian bookworm: mutt 2.2.9-1+deb12u1 Β· GPL-2.0-or-later
- debian trixie: mutt 2.2.13-1+deb13u1 Β· GPL-2.0-or-later
- debian trixie: mutt 2.2.13-1+deb13u2 Β· GPL-2.0-or-later
- ubuntu jammy: mutt 2.1.4-1build1 Β· GPL-2.0-or-later
- ubuntu jammy: mutt 2.1.4-1ubuntu1.2 Β· GPL-2.0-or-later
- ubuntu noble: mutt 2.2.12-0.1build4 Β· GPL-2.0-or-later
- ubuntu questing: mutt 2.2.13-1
- ubuntu resolute: mutt 2.2.13-1build2 Β· GPL-2.0-or-later
- ubuntu stonking: mutt 2.4.1-1 Β· GPL-2.0-or-later
- Copyright (C) 1996-8 Michael R. Elkins <me@cs.hmc.edu>
- Copyright (C) 1998-9 Thomas Roessler <roessler@does-not-exist.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms