Clifton Royston on Mon 4/06 14:30 -1000:
> > > Using perl5.x what is the proper way to lock a mailbox so that
> > > popper nor procmail won't touch it and there is no chance of a
> > > race condition?
> >
> > probably the fcntl() equivalent.
>
> Answers may vary depending on your UNIX flavor, and the type of volume
> you are dealing with. On some system it's still "dot-lock", or IIRC
> fcntl or flock() may be implemented as a "dot-lock".
If you find a system that actually implements fcntl(2) as a dotlock, I
will be completely amazed. They'll either not implement it, or they
will implement as an advisory kernel lock like it should be. Usually
either fcntl() or flock() is just an interface for the other, I believe.
If you have programs that are using dotlocks, upgrade...
> > But keep in mind that all bets are off if you're running server mode
> > because they unlock in the middle of the session.
>
> So you simply need to make sure, first, that a server mode pop session
> isn't already running for that file and that one can't start.
Or you can disable server mode, or you can modify the qpopper source to
surround the whole POP session with a lock instead of just the beginning
and end -- as we've done here -- and still get the advantages of server
mode without worrying about spool corruption. If your MDA and MTA can
properly handle temporary delivery errors (caused by the lock being in
place during a delivery attempt) this is your best option.