mail locking problems

utzoo!decvax!ucbvax!unix-wizards utzoo!decvax!ucbvax!unix-wizards
Tue Sep 29 16:35:40 AEST 1981


>From pur-ee!rick at Berkeley Tue Sep 29 16:33:43 1981
In-reply-to: decvax!duke!smb

There are several possible locking problems that could cause mailboxes
to be garbaged. One is that /bin/mail and /u/ucb/mail use different
conventions as to what a lock is. If they are not the same, obviously,
there will never be any interlocking done and your mailbox can be smashed.

The other that comes to mind is that /bin/mail uses a very poor locking scheme.
It uses the world execute bit of the mailfile to indicate busy, not busy.
The lock code must do a stat, followed by a chmod of the file if it
is not already busy. There is plently of time for a race condition to occur
on a loaded system. I would recommend using the presence of a lock file and
trying to link to it as a pretty reliable interlock scheme. This is similar
to the way /usr/ucb/mail does it (Although they do it on a different file).
---rick
(pur-ee!rick)



More information about the Comp.unix.wizards mailing list