~racb/apport/877852

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Apport bug patterns for Ubuntu
==============================

Purpose
-------

Sometimes a high-visibility crash bug or package installation failure causes a
tremendous amount of duplicate bugs filed through apport, because
Launchpad is not insistant enough to guide people to already existing
similar bugs.

Thus Apport supports patterns which can be matched against a crash (or bug)
report, and directly guide the user to the existing bug instead of
filing a new one first.

Most useful fields are certainly Stacktrace, Package/Dependencies (for
checking particular versions), and ProcCmdline, but in general you can
match any field that seems useful.

To avoid inventing a new file format and to be able to extend the
functionality in the future (e. g. other operators than just regexp matching)
the bug patterns are stored in an XML file, currently on [1].

Syntax
------
The general syntax is:

    root element := <patterns>
    patterns := <pattern url="http://bug.url"> *
    pattern := <re key="report_key">regular expression*</re> +

For example:

    <?xml version="1.0"?>
    <patterns>
        <pattern url="https://launchpad.net/bugs/1">
            <re key="Package">^foo </re>
            <re key="Foo">ba.*r</re>
        </pattern>
        <pattern url="https://launchpad.net/bugs/2">
            <re key="Package">^bar 1-2$</re> <!-- test for a particular version -->
            <re key="Foo">write_(hello|goodbye)</re>
        </pattern>
    </patterns>

The existing bug patterns should provide sufficient examples to
understand real-world applications.  The patterns for gnome-alsamixer and linux
both contain good examples.

Testing
-------
To test that apport is seeing your modified or new bug pattern, you can run
"./test-local" on a .crash file or a Launchpad bug number. This will match the
report against all local bug patterns and give the result. Once this is
working, commit and push them.

Already Reported Bugs
---------------------
In the event that there are bugs already reported in Launchpad that match your
bug pattern you can run "./search-bugs --package linux" to find these bug reports.

For example to search for bugs matching an apport kernel oops:

./search-bugs --package linux --tags apport-kerneloops

These bugs can also automatically consolidated using:

./search-bugs --package linux --tags apport-kerneloops --consolidate

They will then be marked as a duplicate of the bug number in the pattern url.

Rollout
-------
Commits to the Launchpad branch are rolled out to
http://people.canonical.com/~pitti/bugpatterns (where apport will look
for them) every 15 minutes.

Please double and triple check new patterns here. Badly written
patterns can easily lead to unifying *all* possible crashes to one
existing bug!