[PATCH 2/2] Temporarily delete old-style lock files

Sebastian Spaeth Sebastian at SSpaeth.de
Sun Aug 14 09:32:48 BST 2011


The previous locking system would leave around lock files forever. This
commit attempts to delete those. We should include it for one release or
so and then remove it after some time.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
This patch would clean up left-over lock files from the previous locking
system. It is purely optional and I leave it at the discretion of our
maintainer to decide whether we want to carry this patch for one release
before pulling it out again for good. Cleaning up ununsed stuff from old
versions is good, I guess.

 offlineimap/accounts.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py
index a9c6531..cf10c12 100644
--- a/offlineimap/accounts.py
+++ b/offlineimap/accounts.py
@@ -185,6 +185,10 @@ class SyncableAccount(Account):
 
     def unlock(self):
         """Unlock the account, deleting the lock file"""
+        # If there is still an old style lock file around, delete it
+        # TODO: Keep for one version or so, then remove
+        if os.path.isfile(self.config.getmetadatadir() + "/lock"):
+            os.unlink(self.config.getmetadatadir() + "/lock")
         #If we own the lock file, delete it
         if self._lockfd and not self._lockfd.closed:
             self._lockfd.close()
-- 
1.7.4.1





More information about the OfflineIMAP-project mailing list