procmail
[Top] [All Lists]

Re: Unsafe recipe?

2003-03-19 15:28:18
On Wed, Mar 19, 2003 at 01:46:47PM -0800, Tyler F. Creelan wrote:

In the procmailex manual, this recipe is listed for checking duplicate
messages:

 :0 Whc: msgid.lock
 | formail -D 8192 msgid.cache
 :0a:
 trash

It seems an equivalent action can be obtained by calling formail -D in
the condition, however:

:0:
* ? formail -D 8192 msgid.cache
trash

Yet in the latter recipe it is not clear to me if writes to the
msgid.cache file are still atomic - that is, can the msgid.cache file
be overwritten by competing formail processes? If so, how can mutex be
assured on conditions, in addition to actions?

"Atomic" probably really has nothing to do with it.  The formail
process in your version is unprotected by a lockfile, and the
cache is subject to being corrupted by multiple processes,
yes.  (What do you mean by "mutex," anyway?  Oh, never mind,
I just found it with Atomica's one-click Slingshot client:
mutually exclusive, according to Computer Language Company's
_Computer Desktop Encyclopedia_.)

The answer is to use a named "regional" lockfile.
That's a global one (see man pages) that is explicitly
withdrawn.  Here is how I do it:



 LOCKFILE = msgid.cache.lock

 :0  # 030114 () weed out duplicate mail
  * ? formail -D 8192 msgid.cache
  duplicates

 LOCKFILE


-- 
dman

_______________________________________________
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>
  • Re: Unsafe recipe?, Dallman Ross <=