This is the mail archive of the
mailing list for the GCC project.
Prototype of a --report-bug option
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 29 Jul 2014 14:35:40 -0400
- Subject: Prototype of a --report-bug option
- Authentication-results: sourceware.org; auth=none
At Cauldron on the Sunday morning there was a Release Management BoF
session, replacing the specRTL talk (does anyone know what happened to
One of the topics was bug triage, and how many bug reports lacked basic
metadata on e.g. host/build/target, reproducer etc.
I suggested we could automate gathering this, and rashly promised to
write a prototype in Python. So here it is...
The attached script demonstrates a way to generate a URL that, when
followed, takes the user to the GCC Bugzilla "Enter Bug" page, with all
pertinent fields prepopulated with meaningful data. (run the script,
and follow the URL; this uses the same server-side URLs as the "Remember
values as bookmarkable template" BZ button).
The idea is that the "gcc" driver program could gain a --report-bug
feature that injects -save-temps into the options, disables plugins, and
tries to reproduce a crash. It then gives you the URL to click on,
capturing the backtrace and embedding it into the form for you.
Perhaps we could guess the "Component" based on the backtrace.
I note that there doesn't seem to be a "trunk" entry for "Version".
I am both proud of, and scared of, this idea: it could make it easy for
people to file higher-quality bugs. On the other hand, that means more
bugs in the tracker... (they do at least need to be logged in).
Note that this points users at the GCC bug tracker. Presumably
downstream packagers of GCC may want to customize such a feature to
point at their bug trackers (e.g. at Red Hat we have our own bugzilla
instance, with a different set of custom fields).
# Copyright 2014 David Malcolm <firstname.lastname@example.org>
# Copyright 2014 Red Hat, Inc.
# This is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
from collections import OrderedDict
def __init__(self, product, component, version, summary, comment, bug_file_loc=None):
self.product = product
self.component = component
self.version = version
self.summary = summary
self.comment = comment
self.bug_file_loc = bug_file_loc # appears as "URL"
d = OrderedDict()
d['product'] = self.product
d['version'] = self.version
d['component'] = self.component
d['short_desc'] = self.summary
d['comment'] = self.comment
d['bug_file_loc'] = self.bug_file_loc
def make_url(self, base_url):
fields_dict = self.as_fields_dict()
fields_urlfrag = urllib.urlencode(fields_dict, True)
return BASE_URL + 'enter_bug.cgi?%s' % fields_urlfrag
def __init__(self, component, version, summary, comment,
host, target, build,
'gcc', component, version, summary, comment,
self.host = host
self.target = target
self.build = build
d = BzBug.as_fields_dict(self)
for attrname in ['host', 'target', 'build']:
d['cf_gcc%s' % attrname] = getattr(self, attrname)
BASE_URL = 'https://gcc.gnu.org/bugzilla/'
backtrace = '''
bug = GccBug(component='c', # say
version='4.10.0', # can we add "trunk" to the db?
summary="ICE at foo.c:1351: frobnicate_p (insn)",
comment=("Hello world\n" +
"This is a multiline comment\n"
"and it might e.g. have a backtrace:\n"