Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: a819f1e3 by Mark Sapiro at 2020-08-24T15:56:46+00:00 Removed unnecessary call to Lock().disown() from bin/master.py. - - - - - 2972c16b by Mark Sapiro at 2020-08-24T15:56:46+00:00 Merge branch 'lock' into 'master' Removed unnecessary call to Lock().disown() from bin/master.py. Closes #754 See merge request mailman/mailman!693 - - - - - 3 changed files: - src/mailman/bin/master.py - src/mailman/bin/tests/test_master.py - src/mailman/docs/NEWS.rst Changes: ===================================== src/mailman/bin/master.py ===================================== @@ -128,9 +128,14 @@ def acquire_lock_1(force, lock_file=None): if not force: raise # Force removal of lock first. - lock.disown() hostname, pid, tempfile = lock.details os.unlink(lock_file) + # Also remove any stale claim files. + dname = os.path.dirname(lock_file) + for fname in os.listdir(dname): + fpath = os.path.join(dname, fname) + if fpath.startswith(lock_file): + os.unlink(fpath) return acquire_lock_1(force=False) ===================================== src/mailman/bin/tests/test_master.py ===================================== @@ -61,6 +61,15 @@ class TestMaster(unittest.TestCase): lock.unlock() self.assertTrue(is_locked) + def test_acquire_lock_1_force(self): + # Create the lock and lock it. + my_lock = Lock(self.lock_file) + my_lock.lock(timedelta(seconds=60)) + # Try to aquire it again with force. + lock = master.acquire_lock_1(True, self.lock_file) + self.assertTrue(lock.is_locked) + lock.unlock() + def test_master_state(self): my_lock = Lock(self.lock_file) # Mailman is not running. ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -35,6 +35,8 @@ Bugs (Closes #753) * Handle TOCTOU conditions when there are two simultaneous subscription requests for the same email address. (Closes #748) +* Removed unnecessary call to ``Lock().disown()`` from ``bin/master.py``. + (Closes #754) Command line ------------ View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/8f14c86c69829f0cd55bb6722991c5c8f170a0e0...2972c16b7f1c64256053d78dd39d510d6a01e606 -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/8f14c86c69829f0cd55bb6722991c5c8f170a0e0...2972c16b7f1c64256053d78dd39d510d6a01e606 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list -- mailman-checkins@python.org To unsubscribe send an email to mailman-checkins-le...@python.org https://mail.python.org/mailman3/lists/mailman-checkins.python.org/ Member address: arch...@jab.org