procmail
[Top] [All Lists]

Re: Stupid question about :0:

2002-05-10 00:45:20
On Thu, May 09, 2002 at 07:06:46PM +0200, Oliver Fuchs wrote:
... but I don't know what it means ... but for me both are working (:0
and :0:)

Because email may arrive at any time, it is possible to have more than one
process, each handling a separate message, attempt to write to the same mail
file at the same time. This is a bad thing. If two processes write to the same
file at the same time, one will overwrite all or part of what the other wrote,
or worse. The result is a corrupted file. To prevent this, the file should be
locked before attempting to modify it. If a process A wants to modify a file,
and process B has locked it, process A will wait until B removes the lock. A
will then lock the file itself, make it's changes, then remove it's lock.

Using :0: tells procmail that, if it carries out the action contained in that
recipe, it should lock the destination file before it carries out that action.
Using :0 without the second : tells it to not bother with the lock.
Any time procmail delivers a message to a non-unique file, such as an mbox
format mail folder, or a named text file, the file should be locked. 
Instances where a lock is not needed would be things like:
Forwarding to another address (there is no file to lock).
Passing the contents of the message to a shell script (which should[1] take care
of it's own locking, if it's going to write to a file.)
Delivering to an mh or maildir format mail folder, where the folder is a
directory on the filesystem and each message in the folder is a unique file
within that directory (which is popular in NFS environments, where the
filesystem holding a user's mail spool may not be local to the server
delivering to that spool.)

[1] "Should" and "does" are two different things. A properly written script
will take care of it, but you can't always count on it.

-- 
Andrew Edelstein                 -              http://andrew.pure-chaos.com

Please do not reply directly to me, or Cc: me on a reply to a list message.
Replies sent back to the list are more effective, as the discussion remains in
front of the eyes of the rest of the list.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>