provide app to generate a crash/bug report

Bug #172754 reported by Martin Pitt
8
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Won't Fix
Medium
Unassigned
Hardy
Won't Fix
Medium
Unassigned

Bug Description

Binary package hint: apport

We accumulated some specialized helper scripts to generate bug reports in /usr/share/apport/*_hook (currently for apt, gcc, and kernel). More use cases turn up, like generating a report for X.org failures.

This needs to be generalized, so that we have a script which we pass:

 * files to attach
 * arbitrary key/value pairs
 * description
 * report type (default bug)

and which creates a report in /var/crash/, so that the user can ack it.

Martin Pitt (pitti)
Changed in apport:
assignee: nobody → pitti
importance: Undecided → Medium
milestone: none → hardy-alpha-2
status: New → Triaged
Revision history for this message
Steve Langasek (vorlon) wrote :
Changed in apport:
milestone: hardy-alpha-2 → none
Martin Pitt (pitti)
Changed in apport:
assignee: pitti → nobody
Revision history for this message
Braiam Peguero (braiampe) wrote :

This bug should be marked as the fix has been release.

Changed in apport (Ubuntu):
status: Triaged → Fix Released
Changed in apport (Ubuntu Hardy):
status: Triaged → Fix Released
Revision history for this message
Matt Zimmerman (mdz) wrote :

No, this bug is not fixed yet. It's about generalizing scripts like /usr/share/apport/apportcheckresume, gcc_ice_hook, kernel_crashdump, kernel_oops and package_hook.

Changed in apport (Ubuntu Hardy):
status: Fix Released → Won't Fix
Changed in apport (Ubuntu):
status: Fix Released → Triaged
Revision history for this message
Matt Zimmerman (mdz) wrote :

I wish I'd noticed this bug before implementing the Java one and making the problem worse. :-) This is something I'd be interested in working on in my spare time, but I'm not sure what the interface should look like.

Here's what the current scripts do:

apportcheckresume:
- is invoked by apport's upstart job if /var/lib/pm-utils/status exists
- receives no information from the caller
- creates a KernelOops report and attaches some pertinent information
- associates the bug with the kernel package (which has a hook which will do more stuff)

gcc_ice_hook:
- is invoked by gcc itself when an ICE occurs
- receives a path to the compiler executable and a file containing preprocessed output (command line args)
- creates a Bug report and attaches only what it was given
- leaves apport to do the rest (including figure out which package to file on)

kernel_crashdump:
- is invoked by apport's upstart job if /var/crash/vmcore exists
- receives no information from the caller
- creates a KernelCrash report and attaches some pertinent information
- associates the bug with the kernel package (which has a hook which will do more stuff)

kernel_oops:
- is invoked by kerneloops when it detects an oops
- receives a text blob containing the oops data (stdin)
- creates a KernelOops report and attaches some pertinent information
- associates the bug with the kernel package (which has a hook which will do more stuff)

package_hook:
- is invoked by apt when it detects a package install/upgrade failure
- receives a package name, a log file and an error message from the caller (command line args and stdin)
- creates a Package report and attaches the above information
- associates the report with the package which failed
- the general hook has a bunch of logic to further try to find the right package

java_uncaught_exception:
- is invoked by the JVM when a Java program crashes due to an uncaught exception
- receives a list of key/value pairs from the caller and attaches them directly to the report (stdin)
- has some logic to figure out the ExecutablePath based on the URL of the main class (passed in)
- leaves apport to do the rest (including figure out which package to file on)

There isn't really that much common code here that I see, just:

- instantiating the Report object
- adding the information provided by the caller, if any
- calling .add_*_info as appropriate

It might be nice to have a standard way to pass in key/value pairs from the caller, and a convenience function for parsing it and putting it in the report, but that's all that I see which is common. All of the above scripts would still require mostly custom code to do their jobs.

Revision history for this message
Bryce Harrington (bryce) wrote :

I also have a couple such scripts, one for capturing X.org crashes, and another for GPU lockups, which I've independently also been thinking might be able to share some code. However the code I think they'd be sharing is just the generic bits pertaining to X.org logs and such; the triggering mechanisms for the two scripts are quite distinct. There is little in them that I think would be of value to other crash handlers in general. What little there is probably could just be rolled into the apport hook utils library itself.

Maybe it'd be sufficient just to make a thorough tutorial on how to write one. This could then outline in a general way how to set up udev hooks, how to attach info, how to test it, etc.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for the analysis. It was just a rough idea when I filed that, I didn't look into how much common code these hooks have. Once you are in python, we don't need them at all, as the Report class and hookutils already provide a much more convenient and richer interface than you could ever express with a CLI, and the latter isn't type/structure rich enough to do things like passing multiple binary data pipes, etc. So I guess I'll just close this as 'wontfix'.

@Bryce: as for documentation, did you stumble over particular things in hookutils or the general python-apport API which are unclear/dubious? I'm happy to improve the documentation there.

Changed in apport (Ubuntu):
status: Triaged → Won't Fix
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.