[MERGE] use apport to get richer detail in bug reports.
Martin Pool
mbp at canonical.com
Wed Nov 8 04:22:02 GMT 2006
On 8 Nov 2006, Robert Collins <robertc at robertcollins.net> wrote:
> This patch extends the problem reporting command line UI to use
> apport to report more detailed diagnostics which should help in in
> getting faults reported in Malone and provides the basis for capturing
> more information such as detailed logging data from the current
> invocation of bzr in the future (without cluttering 'bzr.log'
> unnecessarily).
Ok, +1.
> As possible future work we could have the more detailed 'only useful in
> cases of errors' data output to a temp file during the bzr run, and then
> unlink that file as we exit *unless* we did a problem report warning to
> the user.
Agree- I'd like
* useless/leftover mutter statements killed
* others sent to stderr by -Dtrace
* also all of them captured and included in bug reports
>
> Right now, this gathers more data for us - for instance it should let us
> tell when users have pycurl or paramiko installed.
>
> It might be an idea to add in the python information about such modules
> when they are present, so that we can tell if a local install has been
> done and is masking the distribution version.
>
> I think writing all this data to a file rather than the screen is nice
> because it avoids blatting a bunch of scary data to the screen and
> instead gives a more detailed explanation of what has gone on and what
> we need to happen - and all the 'scary details' are in the file which
> devs will be happy looking at.
Agree.
> When apport is not present, the old interface is used. I think it would
> be a good idea to change that to a file-writing interface as well, but
> wasn't sure if that would get universal agreement or not ;).
Ok with me as long as -Derror still sends them to stderr.
> # configure convenient aliases for output routines
> @@ -279,7 +281,7 @@
> # specific, but there are too many cases at the moment.
> report_user_error(exc_info, err_file)
> else:
> - report_bug(exc_info, err_file)
> + return report_bug(exc_info, err_file)
This now returns two values if it's a bug but none otherwise, which
seems hard on callers who want to unpack the result...
> + exc_type, exc_object, exc_tb = exc_info
> + err_file.write(
> + "bzr: ERROR: %s.%s: %s\n" % (
> + exc_type.__module__, exc_type.__name__, exc_object)
> + )
> + report = problem_report.ProblemReport()
> + report_file, report_filename = tempfile.mkstemp(
> + suffix='.txt', prefix='bzr-crash-', dir='/tmp')
> + python_report_file = os.fdopen(report_file, 'w')
> + try:
> + report['CommandLine'] = ' '.join(sys.argv)
> + # assume we are packaged as bzr.
> + apport_utils.report_add_package_info(report, 'bzr')
What if bzr is installed but we're not running the installed copy?
> + report['BzrPlugins'] = ' '.join(bzrlib.plugin.all_plugins())
> + tb_file = StringIO()
> + traceback.print_exception(exc_type, exc_object, exc_tb, file=tb_file)
> + report['Traceback'] = tb_file.getvalue()
> + apport_utils.report_add_os_info(report)
> + report.write(python_report_file)
> + # give the user a pretty output.
> +
> + err_file.write(
> + 'This is an unexpected error within bzr and we would appreciate a bug report.\n'
> + '\n'
> + 'bzr has written a crash report file that will assist our debugging of this\n'
> + 'in the file %s\n'
> + '\n'
> + 'This is a plain text file, whose contents you can check if you have privacy\n'
> + 'concerns. We gather the package data about bzr, your command line, plugins\n'
> + 'And the backtrace from within bzr. If you had a password in the URL you\n'
^ should be lowercase.
> + 'provided to bzr, you should edit that file to remove the password.\n'
> + '\n'
> + '** To file a bug for this please visit our bugtracker at the URL \n'
> + '"https://launchpad.net/products/bzr/+filebug" and report a bug describing\n'
> + 'what you were attempting and attach the bzr-crash file mentioned above.\n'
> + 'Alternatively you can email bazaar-ng at lists.canonical.com with the same\n'
> + 'description and attach the bzr-crash file to the email.\n' %
> + report_filename
> + )
Can't we use this text whether we have apport or not?
--
Martin
More information about the bazaar
mailing list