procmail
[Top] [All Lists]

Re: procmail log file corruption

2004-08-24 22:23:01
On Tue, 24 Aug 2004 20:40:45 +0200, Dallman Ross <dman(_at_)nomotek(_dot_)com> 
wrote:

I don't see where that actually writes anything to the logfile.

The "echo" in the TRAP will write output to the log.

Right, but I didn't want to assume that ... things have been left out
of posted examples before.

If that is what he's relying on, then it's obvious what the problem
is; the output to the logfile isn't necessary flushed immediately.  So
it's possible when two procmails are running at once for #1 to run its
trap all they way through to the point where it removes the lockfile,
then get swapped out before all of the output to the logfile is
actually flushed to disk.  At this point #2 gets the lock, writes some
or all of its output to the log, removes the lockfile, finishes and
flushes, and then #1 swaps in again and finishes its own flush.

If you want to synchronize writes using lockfiles, you have to make
sure the write has been fully flushed to disk *before* you remove the
lockfile.  In this case that means opening and closing the logfile
*inside* the trap, e.g., with a redirection like

    echo whatever you want logged >> $LOGFILE

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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