dotlock(1)
π dotlock(1) π
okay bestie, pull up a chair, we're talking about lbdb_dotlock β the little Unix manual that lives in User Manuals, section 1. yes it's giving "ancient mail server energy" but honestly? it's iconic. let's go. π
β¨ NAME β¨
lbdb_dotlock β lock mail spool files. that's it. that's the job. protect the spool, protect the vibe. π
β¨ SYNOPSIS β¨
lbdb_dotlock [-t|-f|-u|-d] [-r retries] file
so it's lbdb_dotlock, then ONE of -t, -f, -u or -d (pick a lane, bestie π), then optionally -r retries if you're feeling spicy, and then the file you're doing all this to. periodt.
β¨ DESCRIPTION β¨
so basically, dotlock is out here implementing the traditional mail spool file locking method. the whole trick is lowkey elegant: to lock file, it creates a file called file.lock. that's the entire personality. one file begets another file. slay. β¨
β¨ OPTIONS β¨
-tβ just try.dotlockwon't actually lock the file, it'll just tell the invoking process whether lockingfileis even possible at all. it's giving "hypothetically, could we?" π¦-fβ force the lock. if some other process has been holding a lock onfilefor longer than a certain amount of time,dotlockwill break that lock by removing the lockfile. ruthless. no cap. π-uβ unlock.dotlockremovesfile.lock. bye bestie π-dβ delete.dotlocklocksfile, removes it if it has length 0, and afterwards removesfile.lock. multi-step main character behavior π-r retriesβ this one tellsdotlockto try lockingretriestimes before giving up, or β if it was invoked with the-fcommand line option β before breaking a lock. the default value is 5. and between each successive locking attempt,dotlockwaits one second. patience is a virtue, i guess π§
β¨ FILES β¨
file.lockβ the lock file thatdotlockgenerates. it's the whole point. the moment. the icon. π
β¨ SEE ALSO β¨
fcntl(2), flock(2), lockfile(1), lbdb-fetchaddr(1) β go read those too, i'm not gatekeeping π«Ά
β¨ DIAGNOSTICS β¨
dotlock gives all its diagnostics in its return values, so like, watch the exit code, bestie:
0 - DL_EX_OKβ the program was successful. we love to see it. π1 - DL_EX_ERRORβ an unspecified error happened, like bad command line parameters, not enough system memory, that kind of thing. it's giving chaos π3 - DL_EX_EXISTβ the user wants to lock a file that some other process has already locked. BUT ifdotlockwas invoked with the-fcommand line option, it won't generate this error β instead it'll break those other processes' locks. bold. π₯4 - DL_EX_NEED_RPIVSβ this return value only shows up ifdotlockwas invoked with the-tcommand line option. it meansdotlockis gonna have to use its group mail privileges to lockfile.5 - DL_EX_IMPOSSIBLEβ this return value also only shows up with the-tcommand line option. it meansdotlockis straight up unable to lockfile. rip. π
β¨ NOTES β¨
dotlock tries to implement an NFS-safe dotlocking method, which was borrowed from lockfile(1). we love a collab. π€
β οΈ okay this part matters: if the user can't openfilefor reading with their normal privileges,dotlockwill return theDL_EX_ERRORexit value β and that's on purpose, to avoid certain attacks against other users' spool files. the code carefully avoids race conditions when checking permissions; for all the gory details, see the comments indotlock.c. π΅οΈβοΈ
β¨ HISTORY β¨
dotlock is part of the Mutt mail user agent package. it was created to avoid running mutt with group mail privileges. a humble origin story honestly πΈ
β¨ AUTHOR β¨
Thomas Roessler <roessler@guug.de> β ty king π«‘
and that's the whole page, bestie!! this one came from Unix, dated JANUARY 2016 π so yeah, shoutout to that source and that date, they're literally the whole footer energy. now go lock your spool files responsibly. mwah πβ¨π
π¦ where this page comes from
- nixos 26.05: lbdb 0.57
- nixpkgs unstable: lbdb 0.57
- ubuntu resolute: lbdb 0.57-1 Β· GPL-2.0-or-later
- ubuntu stonking: lbdb 0.57-1 Β· GPL-2.0-or-later
- Copyright (C) 1996-1998 Michael R. Elkins <me@cs.hmc.edu>
- Copyright (C) 1998-1999 Thomas Roessler <roessler@guug.de>
- Copyright (C) 2005-2025 Roland Rosenfeld <roland@spinnaker.de>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms