Subject: Re: Mail and locking
To: None <current-users@NetBSD.ORG, firstname.lastname@example.org>
From: Grey Wolf <email@example.com>
Date: 12/04/1996 13:55:46
# From firstname.lastname@example.org Wed Dec 4 13:43:40 1996
# > However, I've taken the opportunity to look through some source
# > code, and it's becoming more and more evident that dot locking is
# > not in the slightest bit reliable, because it appears to be done
# > in different ways by different people.
# Please be very careful how you define "reliable" here. It is extremely
# reliable when the correct algorithm is implemented properly. What
# you're saying is only that many people cannot write correct code the
# first few times around. There's nothing new in that!
So where, exactly, do you make the lock?
What do you do if you have a distributed mail scheme (i.e. everyone's
mail goes to their workstation)?
What do you do if you have a centralized mail scheme (i.e. everyone's
mail goes to the mail server and they handle it that way)?
# > And what is your preferred method of fixing a broken mail file?
# > Mail files do break, and you have to have have some way of doing
# > this.
# Well, normally I copy it somewhere private first, and if I happen to
# have something like shlock or newslock that will let me create a valid
# lock file I'll truncate the original spool file too, or I may do it by
# hand. If necessary I'll shut down the mailer for a moment, make sure
# the user's not going to try to read mail, truncate the original spool
# file, and then restart the mailer. If I have no way of creating a sure
# lock I'll just hand the "fixed" mail file to the user in their home
# directory, etc., or I'll again shut down the mailer and append it to
# their spool file.
This is great, except that I think the question is coming from the POV
of a mortal, not the super-user (to anyone with a '#' prompt, the question
more or less answers itself).
How do you fix a broken mail file if you're a normal user?
(to which I would surmise the answer is:
copy the mail file
} while (the spool file is newer than the copy);
truncate the spool file;
fix the copy;
copy the [possibly new] mail file to a different place;
} while (the spool file is newer than the 2nd copy);
concatenate the fixed file and the 2nd copy to the spool file;
delete all copies;
But I digress. The original question is still begged, here.
How do we handle locking?
How do we make the central system honor this locking?
The problems are that we live in an imperfect world in which chaos reigns
most of the time, and we are never going to get all the programs which
use locking to listen to all the other programs which use locking, unless
you have a homogeneous environment.
# I would never ever ever edit a live spool file.
Yeah, that would be bad.