Re: [exim-dev] mbx locking bug in CYGWIN

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: sparrow
Υ/ο: exim-dev
Αντικείμενο: Re: [exim-dev] mbx locking bug in CYGWIN
On Wed, 16 Mar 2005, sparrow wrote:

> I downloaded a copy of uw-imap source code and read through the section of
> mbx.


It was a long time ago, but the comments in the Exim code claim that it
uses the same rules as the c-client library. These are documented in a
long comment in the src/transports/appendfile.c module. Well, it's not
that long, so I'll include it here:

  MBX LOCKING                                                                  


  If use_mbx_lock is set (this is supported only if SUPPORT_MBX is defined)
  then the rules used for locking in c-client are used. Exim takes out a shared
  lock on the mailbox file, and an exclusive lock on the file whose name is
  /tmp/.<device-number>.<inode-number>. The shared lock on the mailbox stops
  any other MBX client from getting an exclusive lock on it and expunging it.
  It also stops any other MBX client from unlinking the /tmp lock when it has
  finished with it.                                                          


  The exclusive lock on the /tmp file prevents any other MBX client from      
  updating the mailbox in any way. When writing is finished, if an exclusive 
  lock on the mailbox can be obtained, indicating there are no current sharers,
  the /tmp file is unlinked.                                                  


  MBX locking can use either fcntl() or flock() locking. If neither             
  use_fcntl_lock or use_flock_lock is set, it defaults to using fcntl() only.   
  The calls for getting these locks are by default non-blocking, as for non-mbx
  locking, but can be made blocking by setting lock_fcntl_timeout and/or   
  lock_flock_timeout as appropriate.  As MBX delivery doesn't work over NFS, it
  probably makes sense to set timeouts for any MBX deliveries.


> I'm wondering if the exim implements mbx open according to mbx_open of
> uw-imap, or some documented specification says it must be implemented this
> way. If a specification exists, I really wish to have a read. If no, I
> think exim sould do as mbx_append when delivery mail using mbx format.


I suspect there is no document, sadly, but it is some years since I
looked at this.

I am very, very, very, hesitant to make any change to this code at this
stage. It has been this way for a long time, and locking problems are
notoriously easy to create and difficult to solve.


-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book