Maildir lock problem

Steven Saner <[email protected]>
Newsgroups gmane.mail.spam.active-spam-killer.general
Message-ID <[email protected]>
Hello:

There seems to be an inconsistency in the deliver_mail method of
askmail.py with regard to locking. In the case of an mbox type of
mailbox, the locking mechanism uses the rc_lockfile configuration
value if it is defined, but for a Maildir type of mailbox it does not.

Since I am using NFS, I need to specify an rc_lockfile so that the
file locking mechanism works. I am also using Maildir, and when I try
to run a remote command that requires the delivery of a queued
message, I would get a "No locks available" message.

I have hacked the askmail.py file to do essentially the same thing for
a Maildir type of mailbox as is done for an mbox type, and that fixes
the error. Is there something I am overlooking that will cause me
problems?

Steve


Here is the diff with my changes:

--- /usr/local/src/ask-2.4.1/askmail.py	Thu May  1 14:37:01 2003
+++ /usr/lib/ask-2.4.1/askmail.py	Thu Aug  7 10:20:22 2003
@@ -122,7 +122,11 @@
 				maildir_file_new = string.replace(maildir_file, "tmp/", "new/")
 
 				if not (os.path.exists(maildir_file) or os.path.exists(maildir_file_new)):
-					fh_mbox = lck.open(maildir_file, "w")
+					lockf = ""
+					if self.config.rc_lockfile != "":
+						lockf = self.config.rc_lockfile + "." + os.path.basename(maildir_file)
+
+					fh_mbox = lck.open(maildir_file, "w", lockf)
 					break
 				else:
 					self.log.write(10, "  deliver_mail(): Maildir file exists. Sleeping and retrying...")
      


-- 
--------------------------------------------------------------------------
Steven Saner <[email protected]>                      Voice:  316-858-3000
Director of Network Operations                          Fax:  316-858-3001
Hubris Communications                                http://www.hubris.net


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.