Thanks for all the help so far.  :-)

I've been thinking (now that's something!) about how mutt interacts
with mail delivery programs and I'm realising that I don't *really*
understand how it all works regarding locking etc.

Take a trivially simple case, mail for user chris is delivered to
/var/mail/chris by, say, postfix.  I run mutt which looks at
/var/mail/chris and displays the index of messages there.

What happens (as regards locks etc.) when mutt is displaying the inbox
index and postfix wants to deliver another message?  Obviously mutt
doesn't keep the file /var/mail/chris permanently locked as otherwise
postfix would never be able to append the new message (if it was
obeying the locking protocol).

So what *does* happen?  Does mutt open the file, scan the contents and
then close it periodically?  This would seem to make sense as it often
does take a while for mutt to notice that postfix has appended a new
message. 

However I don't then understand what's going wrong when my python
script appends a message to /var/mail/chris (or wherever).  What
happens (in the non NFS situation) is that mutt complains "Mailbox
was externally modified. Flags may be wrong."  I can also provoke this
message if I run another copy of mutt and add/delete messages.  This
error doesn't seem to relate to locking at all, it seems to be that
mutt is detecting some *other* change to the mbox file in question.

Can someone tell me what exactly mutt is checking to decide that
"Mailbox was externally modified. Flags may be wrong."?  Is it a check
to see if all messages up to the new appended one are unchanged, or is
it something simpler than this like a simple length check?

-- 
Chris Green

Reply via email to