[ python-Bugs-1512163 ] mailbox (2.5b1): locking doesn't work (esp. on FreeBSD)

SourceForge.net noreply at sourceforge.net
Mon Jun 26 14:56:34 CEST 2006


Bugs item #1512163, was opened at 2006-06-25 11:38
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1512163&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: David Watson (baikie)
Assigned to: A.M. Kuchling (akuchling)
Summary: mailbox (2.5b1): locking doesn't work (esp. on FreeBSD)

Initial Comment:
fcntl/flock() locking of mailboxes is actually disabled
due to a typo:

--- mailbox.py.orig
+++ mailbox.py
@@ -15,7 +15,7 @@
 import rfc822
 import StringIO
 try:
-    import fnctl
+    import fcntl
 except ImportError:
     fcntl = None

However, once enabled, it doesn't work on FreeBSD - the
lock() method always raises ExternalClashError (tested
on 5.3).  This is because flock(), lockf() and fcntl
locking share the same underlying mechanism on this
system (and probably others), and so the second lock
can never be acquired.


----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2006-06-26 08:56

Message:
Logged In: YES 
user_id=11375

Interesting.  The man page for flock() on my Linux system
says of flock() in a certain version:  "This  yields  true 
BSD  semantics: there is no interaction
between the types of lock placed by flock(2) and fcntl(2),
and flock(2) does not detect deadlock."  Apparently this is
out of date, and placing two locks is harmful.

I think it's best to just use one set of locking primitives,
and that one should be lockf(); the flock() calls should be
removed.


----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2006-06-25 15:52

Message:
Logged In: YES 
user_id=33168

Andrew, are you helping maintain this module?  David is
correct that fcntl is mispelled in current svn.  Not sure
what to do about the locking issue.

David, would it be possible for you to work on a patch to
correct this problem?  I'm not sure if any developer has
access to a FreeBSD box similar to yours.  (There are a
couple that use FreeBSD though.)  It would be great to come
up with tests for this if the current ones don't stress this
situation.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1512163&group_id=5470


More information about the Python-bugs-list mailing list