hugday crashes if the bug is listed more than once on the wiki page

Bug #416393 reported by Paul Elms
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hugday tools
New
Undecided
Unassigned

Bug Description

If a bug appears more than once on the BugDay wiki page ie: in as a New bug and also as a Bug to be forwarded upstream. For example bug 370837 on https://wiki.ubuntu.com/UbuntuBugDay/20090820 then the hugday script crashes when trying to close the bug with "hugday close 370837". This results in

Traceback (most recent call last):
  File "/usr/bin/hugday", line 411, in <module>
    sys.exit(main())
  File "/usr/bin/hugday", line 404, in main
    close_bugs(options.bugs, url, options.user)
  File "/usr/bin/hugday", line 339, in close_bugs
    bugs.remove(nr)
ValueError: list.remove(x): x not in list

A workaround is to list the bug number on the command line as many times as it appears on the wiki, so for the above bug "hugday close 370837 370837" works.

Revision history for this message
Paul Elms (scifly) wrote :

I've attached a quick patch that fixes this bug. The bug occurs because the close_bugs function removes the bug number from the bugs list after finding the first matching line on the wiki page. Subsequent wiki lines that match LINE_RE with the same bug number, cannot remove the bug number from bugs as it has already been removed, and the script crashes. A quick check that the bugs list contains the bug nr before removing nr seems the easiest solution to this.
Feel free to ignore this if you have a more elegant solution :)

Revision history for this message
Markus Korn (thekorn) wrote :

Hi Paul,
thanks for your bugreport, and of course for your patch!
However I think I will not fix this bug this way, because at the end of each run I would like to have a list of bugs which could not be closed by the hugday tool (for example because a given id was not found on the wiki page)
So the solution will be to maintain already closed bugs in a separate set and compare both sets at the end to find out which bugs were marked as DONE, and which not.

I think I will work on it later today.

Thanks again,
Markus

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.