I'm having problems getting mutt and a python script to play nicely together with an mbox format mailbox. I get different symptoms according to whether mutt is accessing the mailbox directly or via NFS.
If I open the mbox file with mutt and have mutt displaying the index of messages and then the python script tries to write a new message to the mailbox I would expect the python script to see the file is locked and wait until mutt 'lets go'. What actually happens is that the python script writes to the mbox file and mutt says "Mailbox was externally modified. Flags may be wrong." It's as if locking isn't working at all but the python script is using the python mail libraries and is locking and unlocking correctly as far as I know. If, on the other hand, I open the mbox via NFS with mutt and leave mutt viewing the index and write a message to the mbox from the python script I get a different symptom - mutt just goes to a blank screen with the message "No mailbox is open". Hitting 'c' will open the mbox again because mutt sees the new mail there. Am I misunderstanding how the mbox locking is supposed to work? Should it be possible for another process to write to an mbox file that mutt has 'open' and is displaying the index? If mutt just opens the file and displays the index but closes the file then maybe "Mailbox was externally modified. Flags may be wrong." are just par for the course. However the NFS case seems to suggest that when another process modifies the file it actually becomes a different file from mutt's point of view and the original mbox disappears. -- Chris Green
