fix_url won't save list as no Lock

Bug #610364 reported by David Shrimpton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Mailman
Fix Released
Low
Mark Sapiro

Bug Description

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()

Revision history for this message
Mark Sapiro (msapiro) wrote :

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

Mark Sapiro (msapiro)
Changed in mailman:
assignee: nobody → Mark Sapiro (msapiro)
importance: Undecided → Low
milestone: none → 2.1.14
status: New → Fix Committed
Barry Warsaw (barry)
Changed in mailman:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.