This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Prototype of a --report-bug option


At Cauldron on the Sunday morning there was a Release Management BoF
session, replacing the specRTL talk (does anyone know what happened to
the latter?)

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

Thoughts?
Dave
#   Copyright 2014 David Malcolm <dmalcolm@redhat.com>
#   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
#   <http://www.gnu.org/licenses/>.

from collections import OrderedDict
import urllib

class BzBug:
    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"

    def as_fields_dict(self):
        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
        return d

    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

class GccBug(BzBug):
    def __init__(self, component, version, summary, comment,
                 host, target, build,
                 bug_file_loc=None):
        BzBug.__init__(self,
                       'gcc', component, version, summary, comment,
                       bug_file_loc)
        self.host = host
        self.target = target
        self.build = build

    def as_fields_dict(self):
        d = BzBug.as_fields_dict(self)
        for attrname in ['host', 'target', 'build']:
            d['cf_gcc%s' % attrname] = getattr(self, attrname)
        return d

BASE_URL = 'https://gcc.gnu.org/bugzilla/'
backtrace = '''
foo ()
bar ()
baz ()
'''

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"
                      + backtrace),
             host="x86_64-unknown-linux-gnu",
             target="x86_64-unknown-linux-gnu",
             build="mips-elf"
             )
print(bug.make_url(BASE_URL))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]