[Dovecot] imap locking spool?

Mark Hedges hedges at scriptdolphin.org
Wed Mar 4 21:23:55 EET 2009


On Tue, 3 Mar 2009, Timo Sirainen wrote:
> If you set mbox_read_locks=dotlock, it should get created
> whenever Dovecot is reading the mbox file. But it's
> created ONLY during those times. For example opening a
> mailbox whose index files are up-to-date doesn't cause
> dotlock to be created. And when the mbox is actually being
> read, the dotlock is deleted immediately after the IMAP
> command is finished.
>
> Does openwebmail create longer existing locks?

*sigh*.  No.  It releases the locks as soon as it reads.
(The CGI process ends.)  So if my script accesses by IMAP,
which also releases the locks, openwebmail can change the
folder in the meantime, regardless of what lock mechanism I
use.

On Tue, 3 Mar 2009, Scott Silva wrote:
> Looking at their list it seems as if flock is emulated by
> calling the base fcntl locking routines, so you might be
> OK on this one.
>
> http://openwebmail.acatysmoof.com/archive/html/owm-users/owm-users.200811/msg00006.html

That would be great if it were true, but when I set
openwebmail to use 'flock', then open the spool file
directly with Mail::Box using 'POSIX' locking to keep it
locked, I am still able to access openwebmail, so I could
still change the file.  If I use Mail::Box 'Flock' locking,
it does lock me out of OWM.  I think the guy means that he's
imported the flock constants from Fcntl, and he thinks this
is the same as using Fcntl.  (A misconception that I had to
battle with my predecessor's code, which assumed that a file
was locked if you just imported the constants and did
nothing.)

The lock code is here if anyone is interested:
http://openwebmail.acatysmoof.com/dev/svnweb/index.pl/openwebmail/view/tags/2.53/src/cgi-bin/openwebmail/modules/filelock.pl

Hrmm, rope, poison, or jumping off a bridge?  At this point
I would prefer a firing squad.  An excuse to smoke again.

I think the only real answer is to lock the user's password,
kill any dovecot processes with the username in verbose
proctitle (-HUP? -KILL?), then run my expiration script on
their mailboxes.  OR, use horde.

Mark


More information about the dovecot mailing list