lbdb_dotlock(1)

lbdb_dotlock1

Lock mail spool files.

Usage

lbdb_dotlock [{-t | -f | -u | -d}] [-r retries] file

Overview

dotlock implements the traditional mail spool file locking method: To lock file, a file named file.lock is created.

Options

-t

Just try. dotlock won't actually lock a file, but inform the invoking process if it's at all possible to lock file.

-f

Force the lock. If another process holds a lock on file longer than a certain amount of time, dotlock will break that lock by removing the lockfile.

-u

Unlock. dotlock will remove file.lock.

-d

Delete. dotlock will lock file, remove it if it has length 0, and afterwards remove file.lock.

-r retries

This command line option tells dotlock to try locking retries times before giving up or (if invoked with the -f command line option) break a lock. The default value is 5. dotlock waits one second between successive locking attempts.

Files

file.lock

The lock file dotlock generates.

Diagnostics

dotlock gives all diagnostics in its return values:

0 - DL_EX_OK

The program was successful.

1 - DL_EX_ERROR

An unspecified error such as bad command line parameters, lack of system memory and the like has occurred.

3 - DL_EX_EXIST

The user wants to lock a file which has been locked by another process already. If dotlock is invoked with the -f command line option, dotlock won't generate this error, but break other processes' locks.

4 - DL_EX_NEED_RPIVS

This return value only occurs if dotlock has been invoked with the -t command line option. It means that dotlock will have to use its group mail privileges to lock file.

5 - DL_EX_IMPOSSIBLE

This return value only occurs if dotlock has been invoked with the -t command line option. It means that dotlock is unable to lock file.

Notes

dotlock tries to implement an NFS-safe dotlocking method which was borrowed from lockfile(1).

If the user can't open file for reading with his normal privileges, dotlock will return the DL_EX_ERROR exit value to avoid certain attacks against other users' spool files. The code carefully avoids race conditions when checking permissions; for details of all this see the comments in dotlock.c.

Releases

12 releases since Debian 3.0 (Woody); the text changed 3 times.

  1. 3.0–3.1
  2. 4.0–8
  3. 9
  4. 10–13

History

dotlock is part of the Mutt mail user agent package. It has been created to avoid running mutt with group mail privileges.

Author

Thomas Roessler <[email protected]>

From lbdb 0.56-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.