[Bug 610364] [NEW] fix_url won't save list as no Lock

Public bug reported: In mailman 2.1.13 and 2.1.11 using python 2.52 on a linux host bin/withlist -r fix_url listname -u url fails with Mailman.LockFile.NotLockedError eg bin/withlist -r fix_url listname -u url Importing fix_url... Running fix_url.fix_url()... Loading list test (unlocked) Setting web_page_url to: URL Setting host_name to: HOSTNAME Saving list Traceback (most recent call last): File "bin/withlist", line 299, in <module> main() File "bin/withlist", line 277, in main r = do_list(listname, args, func) File "bin/withlist", line 202, in do_list return func(m, *args) File "/opt/mailman/bin/fix_url.py", line 86, in fix_url mlist.Save() File "/opt/mailman/Mailman/MailList.py", line 559, in Save self.__lock.refresh() File "/opt/mailman/Mailman/LockFile.py", line 229, in refresh raise NotLockedError, '%s: %s' % (repr(self), self.__read()) Mailman.LockFile.NotLockedError: <LockFile 182965119600: /var/opt/mailman/its/locks/test.lock [unlocked: 18000sec] pid=9489>: None Finalizing Fix is *** bin/fix_url.py.orig 2010-05-30 16:12:06.000000000 +1000 --- bin/fix_url.py 2010-07-27 18:19:04.000000000 +1000 *************** *** 83,88 **** --- 83,89 ---- print _('Setting host_name to: %(mailhost)s') mlist.host_name = mailhost print _('Saving list') + mlist.Lock() mlist.Save() mlist.Unlock() ** Affects: mailman Importance: Undecided Status: New -- fix_url won't save list as no Lock https://bugs.launchpad.net/bugs/610364 You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman.

Your suggested fix has two serious problems: 1) Locking the list reloads it as a side effect. Thus, locking after making changes to your instance of the list object will undo those changes. 2) The documentation of fix_url states that it should be run via % bin/withlist -l -r fix_url listname [options] Thus, if it is run as documented (with the -l option to withlist), it will throw an AlreadyLockedError exception when it attempts to lock the already locked list. While this isn't really a bug since fix_url is documented to be run via withlist -l, a patch to "fix" it properly is attached ** Attachment added: "Patch to fix_url to lock an unlocked list." http://launchpadlibrarian.net/52587192/patch -- fix_url won't save list as no Lock https://bugs.launchpad.net/bugs/610364 You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman.

** Changed in: mailman Importance: Undecided => Low ** Changed in: mailman Status: New => Fix Committed ** Changed in: mailman Milestone: None => 2.1.14 ** Changed in: mailman Assignee: (unassigned) => Mark Sapiro (msapiro) -- fix_url won't save list as no Lock https://bugs.launchpad.net/bugs/610364 You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman.

** Changed in: mailman Status: Fix Committed => Fix Released -- fix_url won't save list as no Lock https://bugs.launchpad.net/bugs/610364 You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman.
participants (3)
-
Barry Warsaw
-
David Shrimpton
-
Mark Sapiro