"Harald" == Harald Hanche-Olsen <[EMAIL PROTECTED]> writes:

    Harald> Careful, or a crash at the wrong moment might cause a mail
    Harald> to be moved but not forwarded.

Of course. I intentionally left out the part about running an
occasional cron job (or some such) to check for orphans. We need to
leave some exercises for the reader.

    Harald> I think the race condition
    Harald> you are refering to is more benign: It might cause a
    Harald> message to be forwarded more than once (extremely
    Harald> unlikely), or a qmail-inject or mv to fail because the
    Harald> message was yanked under the script's feet (more likely,
    Harald> since the user may be reading his mail at the same time
    Harald> the cron job is running).

True.

    Harald> In fact, even moving the
    Harald> message first does not get rid of this latter sort of race
    Harald> condition, since there is a time interval between find
    Harald> discovering the file and the mv command running (or
    Harald> between the user's MUA seeing the file and trying to move
    Harald> it).

Ah, true again.

    Harald> If the MUA is not able to cope with the possibility
    Harald> of a message disappearing like that, then the user must
    Harald> precede the reading of his mail by first moving the
    Harald> messages using a more fault tolerant program.  My simple
    Harald> script could also need some work in that area.  I never
    Harald> intended it to be a complete solution, just a reasonable
    Harald> starting point.

Agreed. The user of the script should be aware of the race conditions
in any case.

j.
--
Jay Soffian <[EMAIL PROTECTED]>                       UNIX Systems Administrator
404.572.1941                                             Cox Interactive Media

Reply via email to