Tip: daily Bugzilla reports

This is my inbox, and it sucks:

Bugzilla is like a black hole for bugs. The search tools fail so badly it’s often impossible to find a bug that you were working on the day before. It’s slow, clumsy, and disorganized.

But one bright point is it has a reasonable command line reporting tool also available as a Fedora package. So I decided yesterday to write a Bugzilla report script and have it email me daily from cron.

The starting point is to identify “bugs of interest”. The bugs of interest to me are:

  • bugs I reported
  • bugs I am assigned to fix
  • bugs I’m CC’d on

I put some thought into this set of criteria for bugs:

  1. I should be able to register an interest in any bug: Yes, by adding myself to the CC field.
  2. I should be able to unregister an interest: Yes, by removing myself from the CC, or closing or reassigning those bugs where I’m reporter or assignee.
  3. It shouldn’t tell me about bugs I’m not interested in: Yes, I would be reporter, assignee or in the CC list for any bug related to me or a package I maintain.
  4. It shouldn’t miss out any bugs I might be interested in: Yes, if I’ve ever added a comment, I will be in the CC field at least, and I can always unregister myself from any I no longer care about.

With the command line tool, getting the raw list of bug IDs is very simple.

for flag in -r -c -a; do
  bugzilla query $flag $email -i
done | sort -n -u

(replacing $email with your email address, or even mine if you so care).

That pulls out 781 unique bug IDs, the oldest being one I don’t remember reporting and the most recent being a virt-v2v bug. (Note this includes CLOSED bugs which in the script are ignored).

Now I take the list of bug IDs and pull out the other fields I want from the Bugzilla database. The command below is just an illustrative example of what the script does:

$ bugzilla query -b "86308,601092" \
  --outputformat="%{bug_id}|%{bug_status}|%{product}|%{component}|%{short_desc}" |
  sort -n -t"|"
86308|CLOSED|Red Hat Web Site|Other|Red Hat Command Centre site is down
601092|NEW|Red Hat Enterprise Linux 5|libguestfs|[RFE]Incorrect error msg popped up when missing "-f" in v2v command

As far as I know you have to guess what the %-fields are called. I also had to choose a separator character which wouldn’t appear in any field except the short_desc (which is always the last field), since fields like the product name can and do contain spaces.

The rest of the script is “merely” formatting this whole lot into a nice looking email report:

Bugs in OPEN states:

*** coccinelle ***

  In Fedora:
    502185 coccinelle segfaults on ppc64
    579457 coccinelle-0.2.3rc1 is available

*** e2fsprogs ***

  In Red Hat Enterprise Linux 5:
    518190 mke2fs -t option in RHEL5 differs vs upstream, leading to confusion


You can download the script here: http://oirase.annexia.org/tmp/bugs-report.ml.txt



Filed under Uncategorized

14 responses to “Tip: daily Bugzilla reports

  1. Yaniv

    You could have used Bugzilla whining feature (https://bugzilla.redhat.com/editwhines.cgi)

  2. Leif

    Thanks for this.

    The Bugzilla black-hole as you call it is a real problem. Users would really benefit from a dashboard-like front page (dare i say web 2.0) showing things like would show recent activity i.e.

    1. recently opened bugs
    2. recently closed bugs
    3. bugs with new comments
    4. number of open bugs per product


  3. I guess I’m just a bit confused how this differs from your regular Bugzilla inbox; that uses the exact same ‘bugs of interest’ criteria, so far as I can see. You don’t get emailed about all bugs, only bugs you reported, that are assigned to you, or that you’re in the CC list for.

    The email format could probably be improved a bit – it’d be nice to have any actual state changes summarized in the topic, for e.g. – but I don’t find it horrible enough to have ever wanted to create such a script. And I get a lot of bug mail 🙂

    The % names python-bugzilla uses, btw, come from Bugzilla itself; you can find ’em in the Bugzilla source somewhere, or if it’s something you can search on in the Bugzilla web interface, just do such a search and look at the resulting URL; it’ll have the field name in it.

  4. Dave

    Hello Rich,

    It seems that http://www.annexia.org/tmp/bugs-report.ml.txt is not longer valid? Can you please post again? It seems like a cool utility.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.