procmail
[Top] [All Lists]

Re: Cloning within a LOCKFILE block

1997-10-13 16:56:09
Bill Moseley <moseley(_at_)netcom(_dot_)com> writes:
Bill Moseley asked about using a lockfile on a nexting block

At 12:41 PM 10/12/97 -0500, David W. Tamkin wrote:
Different situation; a nesting block that does not launch a clone cannot
take a local lockfile on the recipe that starts the braces.  A nesting block
that does launch a clone *can*.

Then commented:

...  I feel more comfortable adding
the `w' or `W' flag to the recipe that creates the clone (I've never dared
to try it without `w'), but that may be unnecessary.

I tried it without the "w" and I ended up in a dead-lock situation and I
had to manually remove the lockfile.

Basically, in my .procmailrc I have:

  :0c:file.lockfile
  {
     "file" must not be modified while in here
  }

If the recipes inside the braces try to use file.lockfile as a lockfile,
then you'll have a deadlock situation.  Would you consider including the
actual code involved?


  :0:file.lockfile
  {
    append something to "file"
  }

The lockfile will be ignored here.


Can someone explain why the "w" is important -- and what exactly it is
waiting for?

Firstly, the following:

        :0 c: somefile
        { ... }

is treated just like:

        :0 Wc: somefile
        { ... }

To quote the comment in source code, "try and protect the user from his
blissful ignorance :-)".  The parent will _always_ wait for the cloned
child to exit when a lockfile is involved.  The only question is
whether or not it should be logged.  If you want failure of the cloned
child to be logged, then you should use the 'w' flag, ala:

        :0 wc: somefile
        { ... }

Otherwise, don't.  Does that answer your question?


BTW: the 'W' flag override the 'w' flag.

Philip Guenther

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