Subject: Re: missing "F" on From

From: [email-masked] (Stephen R. van den Berg)
Date: Mon, 28 Feb 1994 13:51:27 +0100

Leo Gestetner <[email-masked]> wrote:
>       I've just started loosing the leading "F" on the first
>>From line on some of my mail.

>Any ideas on what might be causing this?

Well, in another attempt to put an end to the recent flurry of wild
speculations about this phenomenon, these are the facts I know (for sure,
I think :-):

- This is not caused by formail.
- The 'F' being separated from the rest of the mail is caused by
  procmail which usually pauses exactly one second after writing the
  first 'F', and then writes the rest of the mail.  Procmail does this
  to circumvent a bug in NFS concerning atime and mtime updates.
  Procmail only does this if it is writing to a file directly (i.e. not
  when piping into programs/filters).
- This does not cause any mail loss, it only separates the 'F' from the
  rest (in the worst case).
- Since there is this one second pause in every delivery, this
  behaviour tends to uncover unlocked mailboxes (where, in the one second
  pause a second procmail comes in and writes its leading 'F').
- This unlocked mailbox could cause mail loss however, if your mail
  reader and procmail happen to be updating it at the same time.

- Since procmail can employ both kernel-locking and dot-locking techniques
  (and by default, it uses all reliable kernel-locking methods on files where
  it would pause after the leading 'F'):
        a. No kernel locking methods are apparently being used by your
           procmail.  You can verify this by looking in the procmail(1)
           man page, just prior to the NOTES section, it should read
           something like:
                Whenever procmail itself opens a file to deliver to,
                it  doesn't  use any additional kernel locking strategies.
        b. At least one recipe writing directly into this file apparently
           lacks a local lockfile (and is unguarded by a global LOCKFILE).

- If there are severe delivery problems (i.e. if the machine is under extreme
  load) and procmail happens to decide to override a lock (it does that at
  times depending on the LOCKTIMEOUT setting), then both the overriding and
  the overridden procmail will complain about this in the LOGFILE.  So, in this
  case, you could indeed have the same FFrom syndrome, but you should also
  have some warnings in your LOGFILE.

If your procmail does not employ any kernel locking methods, you should be
able to provoke the generation of FFrom lines by using the following testrc
file:
--------------testrc start-----------
:0
newbox
--------------testrc end-----------

You'll also need a file called "oldbox" filled with say 10 mail messages
(don't put in too many, every message will cost one process).
Then start the following command, and watch the fireworks:

	formail -ns procmail ./testrc <oldbox

The FFrom lines should go away if you change the testrc file into:
--------------testrc start-----------
:0:
newbox
--------------testrc end-----------

If you procmail does employ kernel locking methods, you should not be able
to generate the FFrom lines at all.

If you notice anything that contradicts what I said here, let me know (it would
then either be a bug in procmail I can't imagine, or some bug in the kernel
of your OS).

-- 
Sincerely,                                  [email-masked]
           Stephen R. van den Berg (AKA BuGless).

"And now for something *completely* different!"