Merge lp:~xnox/ubuntu/raring/apport/ubuntu into lp:ubuntu/raring/apport

Proposed by Dimitri John Ledkov
Status: Superseded
Proposed branch: lp:~xnox/ubuntu/raring/apport/ubuntu
Merge into: lp:ubuntu/raring/apport
Diff against target: 125999 lines (+124810/-0) (has conflicts)
224 files modified
.bzr-builddeb/default.conf (+2/-0)
.bzrignore (+9/-0)
AUTHORS (+34/-0)
COPYING (+339/-0)
NEWS (+1801/-0)
README (+87/-0)
TODO (+21/-0)
apport/REThread.py (+65/-0)
apport/__init__.py (+73/-0)
apport/com.ubuntu.apport.policy.in (+34/-0)
apport/crashdb.py (+856/-0)
apport/crashdb_impl/debian.py (+113/-0)
apport/crashdb_impl/launchpad.py (+1993/-0)
apport/crashdb_impl/memory.py (+300/-0)
apport/fileutils.py (+376/-0)
apport/hookutils.py (+897/-0)
apport/packaging.py (+237/-0)
apport/report.py (+1528/-0)
apport/sandboxutils.py (+212/-0)
apport/ui.py (+1560/-0)
apport_python_hook.py (+197/-0)
backends/packaging-apt-dpkg.py (+924/-0)
bin/apport-bug (+93/-0)
bin/apport-cli (+368/-0)
bin/apport-retrace (+412/-0)
bin/apport-unpack (+66/-0)
bin/apport-valgrind (+174/-0)
bin/crash-digger (+217/-0)
bin/dupdb-admin (+96/-0)
data/apport (+459/-0)
data/apport-checkreports (+40/-0)
data/apportcheckresume (+91/-0)
data/dump_acpi_tables.py (+54/-0)
data/gcc_ice_hook (+35/-0)
data/general-hooks/automatix.py (+24/-0)
data/general-hooks/generic.py (+94/-0)
data/general-hooks/parse_segv.py (+376/-0)
data/general-hooks/ubuntu.py (+477/-0)
data/icons/scalable/apps/apport.svg (+444/-0)
data/is-enabled (+19/-0)
data/java_uncaught_exception (+92/-0)
data/kernel_crashdump (+45/-0)
data/kernel_oops (+39/-0)
data/package-hooks/source_apport.py (+20/-0)
data/package-hooks/source_debian-installer.py (+59/-0)
data/package-hooks/source_linux-nexus7.py (+25/-0)
data/package-hooks/source_linux.py (+113/-0)
data/package-hooks/source_ubiquity.py (+129/-0)
data/package_hook (+65/-0)
data/recoverable_problem (+47/-0)
data/root_info_wrapper (+3/-0)
data/unkillable_shutdown (+108/-0)
debhelper/apport.pm (+10/-0)
debhelper/dh_apport (+83/-0)
debian/apport-gtk.install (+2/-0)
debian/apport-kde.install (+9/-0)
debian/apport-retrace.install (+5/-0)
debian/apport-valgrind.install (+2/-0)
debian/apport.install (+33/-0)
debian/apport.links (+4/-0)
debian/apport.logrotate (+9/-0)
debian/apport.maintscript (+1/-0)
debian/apport.postinst (+10/-0)
debian/apport.upstart (+50/-0)
debian/changelog (+7406/-0)
debian/clean (+2/-0)
debian/compat (+1/-0)
debian/control (+223/-0)
debian/copyright (+15/-0)
debian/dh-apport.install (+2/-0)
debian/dh-apport.manpages (+1/-0)
debian/python-apport.install (+2/-0)
debian/python-problem-report.install (+1/-0)
debian/python3-apport.install (+2/-0)
debian/python3-problem-report.install (+1/-0)
debian/rules (+39/-0)
debian/source/format (+1/-0)
debian/tests/control (+3/-0)
debian/tests/upstream-system (+16/-0)
debian/watch (+2/-0)
doc/crashdb-conf.txt (+149/-0)
doc/data-format.tex (+301/-0)
doc/package-hooks.txt (+158/-0)
doc/symptoms.txt (+73/-0)
etc/apport/blacklist.d/README.blacklist (+4/-0)
etc/apport/blacklist.d/apport (+5/-0)
etc/apport/crashdb.conf (+37/-0)
etc/bash_completion.d/apport_completion (+268/-0)
etc/cron.daily/apport (+4/-0)
etc/default/apport (+4/-0)
etc/init.d/apport (+110/-0)
gtk/apport-gtk (+590/-0)
gtk/apport-gtk-mime.desktop.in (+12/-0)
gtk/apport-gtk.desktop.in (+12/-0)
gtk/apport-gtk.ui (+597/-0)
java/README (+13/-0)
java/com/ubuntu/apport/ApportUncaughtExceptionHandler.java (+108/-0)
java/crash.java (+8/-0)
kde/apport-kde (+522/-0)
kde/apport-kde-mime.desktop.in (+12/-0)
kde/apport-kde-mimelnk.desktop.in (+9/-0)
kde/apport-kde.desktop.in (+11/-0)
kde/bugreport.ui (+177/-0)
kde/choices.ui (+95/-0)
kde/error.ui (+136/-0)
kde/progress.ui (+115/-0)
kde/userpass.ui (+127/-0)
man/apport-bug.1 (+129/-0)
man/apport-cli.1 (+150/-0)
man/apport-retrace.1 (+190/-0)
man/apport-unpack.1 (+32/-0)
man/apport-valgrind.1 (+125/-0)
man/dupdb-admin.1 (+68/-0)
pm-utils/sleep.d/000record-status (+16/-0)
po/ace.po (+840/-0)
po/af.po (+840/-0)
po/am.po (+840/-0)
po/an.po (+840/-0)
po/apport.pot (+835/-0)
po/ar.po (+1177/-0)
po/ast.po (+1035/-0)
po/be.po (+1071/-0)
po/bg.po (+992/-0)
po/bn.po (+858/-0)
po/br.po (+840/-0)
po/bs.po (+861/-0)
po/ca.po (+1100/-0)
po/ca@valencia.po (+900/-0)
po/cs.po (+1053/-0)
po/cv.po (+840/-0)
po/da.po (+1042/-0)
po/de.po (+1145/-0)
po/el.po (+1116/-0)
po/en_AU.po (+1094/-0)
po/en_CA.po (+1081/-0)
po/en_GB.po (+1094/-0)
po/eo.po (+1053/-0)
po/es.po (+1124/-0)
po/et.po (+1211/-0)
po/eu.po (+1023/-0)
po/fa.po (+840/-0)
po/fi.po (+1086/-0)
po/fr.po (+1267/-0)
po/ga.po (+840/-0)
po/gd.po (+840/-0)
po/gl.po (+1121/-0)
po/gu.po (+884/-0)
po/he.po (+1002/-0)
po/hi.po (+881/-0)
po/hr.po (+997/-0)
po/hu.po (+1110/-0)
po/hy.po (+840/-0)
po/id.po (+1211/-0)
po/is.po (+975/-0)
po/it.po (+1094/-0)
po/ja.po (+1166/-0)
po/kab.po (+840/-0)
po/kk.po (+840/-0)
po/km.po (+958/-0)
po/kn.po (+908/-0)
po/ko.po (+962/-0)
po/ku.po (+928/-0)
po/lo.po (+840/-0)
po/lt.po (+1095/-0)
po/lv.po (+859/-0)
po/mk.po (+840/-0)
po/ml.po (+840/-0)
po/ms.po (+983/-0)
po/my.po (+844/-0)
po/nb.po (+1019/-0)
po/nds.po (+878/-0)
po/ne.po (+852/-0)
po/nl.po (+1045/-0)
po/oc.po (+1120/-0)
po/pl.po (+1281/-0)
po/pt.po (+1030/-0)
po/pt_BR.po (+1117/-0)
po/ro.po (+1055/-0)
po/ru.po (+1257/-0)
po/sc.po (+840/-0)
po/se.po (+840/-0)
po/shn.po (+840/-0)
po/si.po (+844/-0)
po/sk.po (+1008/-0)
po/sl.po (+1069/-0)
po/sq.po (+1045/-0)
po/sr.po (+1306/-0)
po/sv.po (+1104/-0)
po/ta.po (+874/-0)
po/te.po (+850/-0)
po/th.po (+879/-0)
po/tr.po (+1262/-0)
po/ug.po (+991/-0)
po/uk.po (+1203/-0)
po/uz.po (+839/-0)
po/vi.po (+1008/-0)
po/zh_CN.po (+965/-0)
po/zh_HK.po (+844/-0)
po/zh_TW.po (+979/-0)
problem_report.py (+634/-0)
setup.py (+129/-0)
test/run (+128/-0)
test/test_apport_unpack.py (+116/-0)
test/test_apport_valgrind.py (+154/-0)
test/test_backend_apt_dpkg.py (+781/-0)
test/test_crash_digger.py (+237/-0)
test/test_crashdb.py (+694/-0)
test/test_fileutils.py (+342/-0)
test/test_hooks.py (+270/-0)
test/test_hookutils.py (+453/-0)
test/test_java_crashes.py (+92/-0)
test/test_packaging.py (+16/-0)
test/test_parse_segv.py (+544/-0)
test/test_problem_report.py (+988/-0)
test/test_python_crashes.py (+398/-0)
test/test_recoverable_problem.py (+76/-0)
test/test_report.py (+2120/-0)
test/test_rethread.py (+88/-0)
test/test_signal_crashes.py (+672/-0)
test/test_ui.py (+2106/-0)
test/test_ui_gtk.py (+863/-0)
test/test_ui_kde.py (+607/-0)
use-local (+7/-0)
xdg-mime/apport.xml (+11/-0)
Conflict adding file AUTHORS.  Moved existing file to AUTHORS.moved.
Conflict adding file COPYING.  Moved existing file to COPYING.moved.
Conflict adding file NEWS.  Moved existing file to NEWS.moved.
Conflict adding file README.  Moved existing file to README.moved.
Conflict adding file TODO.  Moved existing file to TODO.moved.
Conflict adding file apport.  Moved existing file to apport.moved.
Conflict adding file apport_python_hook.py.  Moved existing file to apport_python_hook.py.moved.
Conflict adding file backends.  Moved existing file to backends.moved.
Conflict adding file bin.  Moved existing file to bin.moved.
Conflict adding file data.  Moved existing file to data.moved.
Conflict adding file debhelper.  Moved existing file to debhelper.moved.
Conflict adding file debian.  Moved existing file to debian.moved.
Conflict adding file doc.  Moved existing file to doc.moved.
Conflict adding file etc.  Moved existing file to etc.moved.
Conflict adding file gtk.  Moved existing file to gtk.moved.
Conflict adding file java.  Moved existing file to java.moved.
Conflict adding file kde.  Moved existing file to kde.moved.
Conflict adding file man.  Moved existing file to man.moved.
Conflict adding file pm-utils.  Moved existing file to pm-utils.moved.
Conflict adding file po.  Moved existing file to po.moved.
Conflict adding file problem_report.py.  Moved existing file to problem_report.py.moved.
Conflict adding file setup.py.  Moved existing file to setup.py.moved.
Conflict adding file test.  Moved existing file to test.moved.
Conflict adding file use-local.  Moved existing file to use-local.moved.
Conflict adding file xdg-mime.  Moved existing file to xdg-mime.moved.
To merge this branch: bzr merge lp:~xnox/ubuntu/raring/apport/ubuntu
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+153223@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

2165. By Dimitri John Ledkov

Include ubiquity.log generated by upstart for the ubiquity.conf
upstart job.

2164. By Martin Pitt

releasing version 2.9.1-0ubuntu1

2163. By Martin Pitt

Bump Standards-Version to 3.9.4 (no changes necessary).

2162. By Martin Pitt

new upstream release 2.9.1

2161. By Martin Pitt

releasing version 2.9-0ubuntu2

2160. By Martin Pitt

* Merge from trunk:
  - test_signal_crashes.py: Fix test_crash_apport() when being run under
    LD_PRELOAD.

2159. By Martin Pitt

releasing version 2.9-0ubuntu1

2158. By Martin Pitt

data/general-hooks/ubuntu.py: Drop unused pwd import

2157. By Martin Pitt

new upstream release 2.9

2156. By Brian Murray

source_ubiquity.py: set a default value for cd_error

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.bzr-builddeb'
2=== added file '.bzr-builddeb/default.conf'
3--- .bzr-builddeb/default.conf 1970-01-01 00:00:00 +0000
4+++ .bzr-builddeb/default.conf 2013-03-13 18:57:21 +0000
5@@ -0,0 +1,2 @@
6+[BUILDDEB]
7+merge = True
8
9=== added file '.bzrignore'
10--- .bzrignore 1970-01-01 00:00:00 +0000
11+++ .bzrignore 2013-03-13 18:57:21 +0000
12@@ -0,0 +1,9 @@
13+apport/packaging_impl.py
14+debhelper/dh_apport.1
15+doc/*.aux
16+doc/*.log
17+doc/*.pdf
18+doc/*.toc
19+build
20+dist
21+MANIFEST
22
23=== added file 'AUTHORS'
24--- AUTHORS 1970-01-01 00:00:00 +0000
25+++ AUTHORS 2013-03-13 18:57:21 +0000
26@@ -0,0 +1,34 @@
27+Copyright:
28+---------
29+General:
30+ Copyright (C) 2006 - 2011 Canonical Ltd.
31+
32+backends/packaging_rpm.py:
33+ Copyright (C) 2007 Red Hat Inc.
34+
35+Authors and Contributors:
36+-------------------------
37+Martin Pitt <martin.pitt@ubuntu.com>:
38+ Lead developer, design, backend, GTK frontend development,
39+ maintenance of other frontends
40+
41+Michael Hofmann <mh21@piware.de>:
42+ Creation of Qt4 and CLI frontends
43+
44+Richard A. Johnson <nixternal@ubuntu.com>:
45+ Changed Qt4 frontend to KDE frontend
46+
47+Robert Collins <robert@ubuntu.com>:
48+ Python crash hook
49+
50+Will Woods <wwoods@redhat.com>:
51+ RPM packaging backend
52+
53+Matt Zimmerman <mdz@canonical.com>:
54+ Convenience function library for hooks (apport/hookutils.py)
55+
56+Troy James Sobotka <troy.sobotka@gmail.com>:
57+ Apport icon (apport/apport.svg)
58+
59+Kees Cook <kees.cook@canonical.com>:
60+ Various fixes, additional GDB output, SEGV parser.
61
62=== renamed file 'AUTHORS' => 'AUTHORS.moved'
63=== added file 'COPYING'
64--- COPYING 1970-01-01 00:00:00 +0000
65+++ COPYING 2013-03-13 18:57:21 +0000
66@@ -0,0 +1,339 @@
67+ GNU GENERAL PUBLIC LICENSE
68+ Version 2, June 1991
69+
70+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
71+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
72+ Everyone is permitted to copy and distribute verbatim copies
73+ of this license document, but changing it is not allowed.
74+
75+ Preamble
76+
77+ The licenses for most software are designed to take away your
78+freedom to share and change it. By contrast, the GNU General Public
79+License is intended to guarantee your freedom to share and change free
80+software--to make sure the software is free for all its users. This
81+General Public License applies to most of the Free Software
82+Foundation's software and to any other program whose authors commit to
83+using it. (Some other Free Software Foundation software is covered by
84+the GNU Lesser General Public License instead.) You can apply it to
85+your programs, too.
86+
87+ When we speak of free software, we are referring to freedom, not
88+price. Our General Public Licenses are designed to make sure that you
89+have the freedom to distribute copies of free software (and charge for
90+this service if you wish), that you receive source code or can get it
91+if you want it, that you can change the software or use pieces of it
92+in new free programs; and that you know you can do these things.
93+
94+ To protect your rights, we need to make restrictions that forbid
95+anyone to deny you these rights or to ask you to surrender the rights.
96+These restrictions translate to certain responsibilities for you if you
97+distribute copies of the software, or if you modify it.
98+
99+ For example, if you distribute copies of such a program, whether
100+gratis or for a fee, you must give the recipients all the rights that
101+you have. You must make sure that they, too, receive or can get the
102+source code. And you must show them these terms so they know their
103+rights.
104+
105+ We protect your rights with two steps: (1) copyright the software, and
106+(2) offer you this license which gives you legal permission to copy,
107+distribute and/or modify the software.
108+
109+ Also, for each author's protection and ours, we want to make certain
110+that everyone understands that there is no warranty for this free
111+software. If the software is modified by someone else and passed on, we
112+want its recipients to know that what they have is not the original, so
113+that any problems introduced by others will not reflect on the original
114+authors' reputations.
115+
116+ Finally, any free program is threatened constantly by software
117+patents. We wish to avoid the danger that redistributors of a free
118+program will individually obtain patent licenses, in effect making the
119+program proprietary. To prevent this, we have made it clear that any
120+patent must be licensed for everyone's free use or not licensed at all.
121+
122+ The precise terms and conditions for copying, distribution and
123+modification follow.
124+
125+ GNU GENERAL PUBLIC LICENSE
126+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
127+
128+ 0. This License applies to any program or other work which contains
129+a notice placed by the copyright holder saying it may be distributed
130+under the terms of this General Public License. The "Program", below,
131+refers to any such program or work, and a "work based on the Program"
132+means either the Program or any derivative work under copyright law:
133+that is to say, a work containing the Program or a portion of it,
134+either verbatim or with modifications and/or translated into another
135+language. (Hereinafter, translation is included without limitation in
136+the term "modification".) Each licensee is addressed as "you".
137+
138+Activities other than copying, distribution and modification are not
139+covered by this License; they are outside its scope. The act of
140+running the Program is not restricted, and the output from the Program
141+is covered only if its contents constitute a work based on the
142+Program (independent of having been made by running the Program).
143+Whether that is true depends on what the Program does.
144+
145+ 1. You may copy and distribute verbatim copies of the Program's
146+source code as you receive it, in any medium, provided that you
147+conspicuously and appropriately publish on each copy an appropriate
148+copyright notice and disclaimer of warranty; keep intact all the
149+notices that refer to this License and to the absence of any warranty;
150+and give any other recipients of the Program a copy of this License
151+along with the Program.
152+
153+You may charge a fee for the physical act of transferring a copy, and
154+you may at your option offer warranty protection in exchange for a fee.
155+
156+ 2. You may modify your copy or copies of the Program or any portion
157+of it, thus forming a work based on the Program, and copy and
158+distribute such modifications or work under the terms of Section 1
159+above, provided that you also meet all of these conditions:
160+
161+ a) You must cause the modified files to carry prominent notices
162+ stating that you changed the files and the date of any change.
163+
164+ b) You must cause any work that you distribute or publish, that in
165+ whole or in part contains or is derived from the Program or any
166+ part thereof, to be licensed as a whole at no charge to all third
167+ parties under the terms of this License.
168+
169+ c) If the modified program normally reads commands interactively
170+ when run, you must cause it, when started running for such
171+ interactive use in the most ordinary way, to print or display an
172+ announcement including an appropriate copyright notice and a
173+ notice that there is no warranty (or else, saying that you provide
174+ a warranty) and that users may redistribute the program under
175+ these conditions, and telling the user how to view a copy of this
176+ License. (Exception: if the Program itself is interactive but
177+ does not normally print such an announcement, your work based on
178+ the Program is not required to print an announcement.)
179+
180+These requirements apply to the modified work as a whole. If
181+identifiable sections of that work are not derived from the Program,
182+and can be reasonably considered independent and separate works in
183+themselves, then this License, and its terms, do not apply to those
184+sections when you distribute them as separate works. But when you
185+distribute the same sections as part of a whole which is a work based
186+on the Program, the distribution of the whole must be on the terms of
187+this License, whose permissions for other licensees extend to the
188+entire whole, and thus to each and every part regardless of who wrote it.
189+
190+Thus, it is not the intent of this section to claim rights or contest
191+your rights to work written entirely by you; rather, the intent is to
192+exercise the right to control the distribution of derivative or
193+collective works based on the Program.
194+
195+In addition, mere aggregation of another work not based on the Program
196+with the Program (or with a work based on the Program) on a volume of
197+a storage or distribution medium does not bring the other work under
198+the scope of this License.
199+
200+ 3. You may copy and distribute the Program (or a work based on it,
201+under Section 2) in object code or executable form under the terms of
202+Sections 1 and 2 above provided that you also do one of the following:
203+
204+ a) Accompany it with the complete corresponding machine-readable
205+ source code, which must be distributed under the terms of Sections
206+ 1 and 2 above on a medium customarily used for software interchange; or,
207+
208+ b) Accompany it with a written offer, valid for at least three
209+ years, to give any third party, for a charge no more than your
210+ cost of physically performing source distribution, a complete
211+ machine-readable copy of the corresponding source code, to be
212+ distributed under the terms of Sections 1 and 2 above on a medium
213+ customarily used for software interchange; or,
214+
215+ c) Accompany it with the information you received as to the offer
216+ to distribute corresponding source code. (This alternative is
217+ allowed only for noncommercial distribution and only if you
218+ received the program in object code or executable form with such
219+ an offer, in accord with Subsection b above.)
220+
221+The source code for a work means the preferred form of the work for
222+making modifications to it. For an executable work, complete source
223+code means all the source code for all modules it contains, plus any
224+associated interface definition files, plus the scripts used to
225+control compilation and installation of the executable. However, as a
226+special exception, the source code distributed need not include
227+anything that is normally distributed (in either source or binary
228+form) with the major components (compiler, kernel, and so on) of the
229+operating system on which the executable runs, unless that component
230+itself accompanies the executable.
231+
232+If distribution of executable or object code is made by offering
233+access to copy from a designated place, then offering equivalent
234+access to copy the source code from the same place counts as
235+distribution of the source code, even though third parties are not
236+compelled to copy the source along with the object code.
237+
238+ 4. You may not copy, modify, sublicense, or distribute the Program
239+except as expressly provided under this License. Any attempt
240+otherwise to copy, modify, sublicense or distribute the Program is
241+void, and will automatically terminate your rights under this License.
242+However, parties who have received copies, or rights, from you under
243+this License will not have their licenses terminated so long as such
244+parties remain in full compliance.
245+
246+ 5. You are not required to accept this License, since you have not
247+signed it. However, nothing else grants you permission to modify or
248+distribute the Program or its derivative works. These actions are
249+prohibited by law if you do not accept this License. Therefore, by
250+modifying or distributing the Program (or any work based on the
251+Program), you indicate your acceptance of this License to do so, and
252+all its terms and conditions for copying, distributing or modifying
253+the Program or works based on it.
254+
255+ 6. Each time you redistribute the Program (or any work based on the
256+Program), the recipient automatically receives a license from the
257+original licensor to copy, distribute or modify the Program subject to
258+these terms and conditions. You may not impose any further
259+restrictions on the recipients' exercise of the rights granted herein.
260+You are not responsible for enforcing compliance by third parties to
261+this License.
262+
263+ 7. If, as a consequence of a court judgment or allegation of patent
264+infringement or for any other reason (not limited to patent issues),
265+conditions are imposed on you (whether by court order, agreement or
266+otherwise) that contradict the conditions of this License, they do not
267+excuse you from the conditions of this License. If you cannot
268+distribute so as to satisfy simultaneously your obligations under this
269+License and any other pertinent obligations, then as a consequence you
270+may not distribute the Program at all. For example, if a patent
271+license would not permit royalty-free redistribution of the Program by
272+all those who receive copies directly or indirectly through you, then
273+the only way you could satisfy both it and this License would be to
274+refrain entirely from distribution of the Program.
275+
276+If any portion of this section is held invalid or unenforceable under
277+any particular circumstance, the balance of the section is intended to
278+apply and the section as a whole is intended to apply in other
279+circumstances.
280+
281+It is not the purpose of this section to induce you to infringe any
282+patents or other property right claims or to contest validity of any
283+such claims; this section has the sole purpose of protecting the
284+integrity of the free software distribution system, which is
285+implemented by public license practices. Many people have made
286+generous contributions to the wide range of software distributed
287+through that system in reliance on consistent application of that
288+system; it is up to the author/donor to decide if he or she is willing
289+to distribute software through any other system and a licensee cannot
290+impose that choice.
291+
292+This section is intended to make thoroughly clear what is believed to
293+be a consequence of the rest of this License.
294+
295+ 8. If the distribution and/or use of the Program is restricted in
296+certain countries either by patents or by copyrighted interfaces, the
297+original copyright holder who places the Program under this License
298+may add an explicit geographical distribution limitation excluding
299+those countries, so that distribution is permitted only in or among
300+countries not thus excluded. In such case, this License incorporates
301+the limitation as if written in the body of this License.
302+
303+ 9. The Free Software Foundation may publish revised and/or new versions
304+of the General Public License from time to time. Such new versions will
305+be similar in spirit to the present version, but may differ in detail to
306+address new problems or concerns.
307+
308+Each version is given a distinguishing version number. If the Program
309+specifies a version number of this License which applies to it and "any
310+later version", you have the option of following the terms and conditions
311+either of that version or of any later version published by the Free
312+Software Foundation. If the Program does not specify a version number of
313+this License, you may choose any version ever published by the Free Software
314+Foundation.
315+
316+ 10. If you wish to incorporate parts of the Program into other free
317+programs whose distribution conditions are different, write to the author
318+to ask for permission. For software which is copyrighted by the Free
319+Software Foundation, write to the Free Software Foundation; we sometimes
320+make exceptions for this. Our decision will be guided by the two goals
321+of preserving the free status of all derivatives of our free software and
322+of promoting the sharing and reuse of software generally.
323+
324+ NO WARRANTY
325+
326+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
327+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
328+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
329+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
330+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
331+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
332+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
333+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
334+REPAIR OR CORRECTION.
335+
336+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
337+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
338+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
339+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
340+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
341+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
342+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
343+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
344+POSSIBILITY OF SUCH DAMAGES.
345+
346+ END OF TERMS AND CONDITIONS
347+
348+ How to Apply These Terms to Your New Programs
349+
350+ If you develop a new program, and you want it to be of the greatest
351+possible use to the public, the best way to achieve this is to make it
352+free software which everyone can redistribute and change under these terms.
353+
354+ To do so, attach the following notices to the program. It is safest
355+to attach them to the start of each source file to most effectively
356+convey the exclusion of warranty; and each file should have at least
357+the "copyright" line and a pointer to where the full notice is found.
358+
359+ <one line to give the program's name and a brief idea of what it does.>
360+ Copyright (C) <year> <name of author>
361+
362+ This program is free software; you can redistribute it and/or modify
363+ it under the terms of the GNU General Public License as published by
364+ the Free Software Foundation; either version 2 of the License, or
365+ (at your option) any later version.
366+
367+ This program is distributed in the hope that it will be useful,
368+ but WITHOUT ANY WARRANTY; without even the implied warranty of
369+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
370+ GNU General Public License for more details.
371+
372+ You should have received a copy of the GNU General Public License along
373+ with this program; if not, write to the Free Software Foundation, Inc.,
374+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
375+
376+Also add information on how to contact you by electronic and paper mail.
377+
378+If the program is interactive, make it output a short notice like this
379+when it starts in an interactive mode:
380+
381+ Gnomovision version 69, Copyright (C) year name of author
382+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
383+ This is free software, and you are welcome to redistribute it
384+ under certain conditions; type `show c' for details.
385+
386+The hypothetical commands `show w' and `show c' should show the appropriate
387+parts of the General Public License. Of course, the commands you use may
388+be called something other than `show w' and `show c'; they could even be
389+mouse-clicks or menu items--whatever suits your program.
390+
391+You should also get your employer (if you work as a programmer) or your
392+school, if any, to sign a "copyright disclaimer" for the program, if
393+necessary. Here is a sample; alter the names:
394+
395+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
396+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
397+
398+ <signature of Ty Coon>, 1 April 1989
399+ Ty Coon, President of Vice
400+
401+This General Public License does not permit incorporating your program into
402+proprietary programs. If your program is a subroutine library, you may
403+consider it more useful to permit linking proprietary applications with the
404+library. If this is what you want to do, use the GNU Lesser General
405+Public License instead of this License.
406
407=== renamed file 'COPYING' => 'COPYING.moved'
408=== added file 'NEWS'
409--- NEWS 1970-01-01 00:00:00 +0000
410+++ NEWS 2013-03-13 18:57:21 +0000
411@@ -0,0 +1,1801 @@
412+This file summarizes the major and interesting changes for each release. For a
413+detailled list of changes, please see ChangeLog.
414+
415+2.9.1 (2013-03-07):
416+-------------------
417+Improvements:
418+ * launchpad.py: Add support for filing bugs as private. Document this in
419+ doc/crashdb-conf.txt. (LP: #1144647)
420+
421+Bug fixes:
422+ * test_signal_crashes.py: Fix test_crash_apport() when being run under
423+ LD_PRELOAD.
424+ * Fix crash in error() and warning() if there is no sys.stderr. (LP: #1012445)
425+ * Fix Turkish translation to add missing keyboard accelerator. (LP: #648750)
426+ * fileutils.py, find_package_desktopfile(): Restrict to autostart and
427+ application .desktop files. (LP: #1147528)
428+ * apt/dpkg get_modified_files(): Fix crash when encountering non-ASCII file
429+ names in an ASCII locale. (LP: #1044014)
430+
431+2.9 (2013-03-01):
432+-----------------
433+Improvements:
434+ * fileutils.py, shared_libraries(): Return a "name → path" dict instead of
435+ just a set of names. Thanks Kyle Nitzsche.
436+ * sandboxutils.py: Support unpackaged executables, i. e. reports which do not
437+ have "Package" and "Dependencies" fields. For those, get required libraries
438+ from "ProcMaps". Thanks Kyle Nitzsche.
439+
440+Bug fixes:
441+ * Add "com.ubuntu.apport.apport-gtk-root" polkit action for running apport-gtk
442+ through pkexec to access system crash reports. Thanks Brian Murray.
443+ * ui.py: Check $PKEXEC_UID in addition to $SUDO_UID for opening a browser.
444+ * apport/report.py: report if LD_PRELOAD and LD_LIBRARY_PATH are set. Thanks
445+ James Hunt.
446+ * apport-valgrind: Cleanly exit on keyboard interrupts. Thanks Kyle Nitzsche.
447+ * debian.py: Fix "string payload expected" crash when building the report.
448+ Thanks Dmitry Shachnev. (Debian #698010)
449+ * Move shared_libraries() and links_with_shared_library() from hookutils into
450+ fileutils, so that we can use it from apport-valgrind. Thanks to Kyle
451+ Nitzsche for the initial patch.
452+ * fileutils.shared_libraries(): Filter out virtual "linux-vdso" from result.
453+ Thanks Kyle Nitzsche.
454+ * apport-valgrind: Fix path to debug symbols in the sandbox.
455+ * ui.py, get_desktop_entry(): Fix for Python 2.
456+
457+2.8 (2013-01-08):
458+-----------------
459+Improvements:
460+ * Factor out sandbox management functions from apport-retrace into
461+ apport/sandboxutils.py, so that other programs can re-use the API easily.
462+ Thanks to Kyle Nitzsche for the initial work on this.
463+ * Generate a crash signature for kernel OOPSes.
464+ * Add "apport-valgrind" tool to produce valgrind reports in a temporary
465+ sandbox with debug symbols (similar to apport-retrace). Thanks Alex Chiang
466+ and Kyle Nitzsche!
467+
468+Bug fixes:
469+ * Fix StacktraceAddressSignature generation on ARM. (LP: #1089778)
470+ * debian.py: Fix TypeError crash in payload generation. Thanks Ritesh Raj
471+ Sarraf.
472+ * apport_python_hook.py: Update "ExecutableTimestamp" field when mangling
473+ "ExecutablePath". (LP: #1077253)
474+
475+2.7 (2012-12-10):
476+-----------------
477+Improvements:
478+ * packaging.py, get_file_package(): Add optional "release" and "arch"
479+ arguments for getting a file's package for a foreign release or
480+ architecture. Implement this for apt/dpkg backend.
481+ * packaging.py, install_packages(): Add optional "architecture" argument for
482+ creating a sandbox for a foreign architecture. Implement this for apt/dpkg
483+ backend.
484+ * When a report's architecture does not match the system architecture, try to
485+ use gdb-multiarch (if available, as packaged on Debian/Ubuntu), and set
486+ architecture and gnutarget accordingly in gdb. This supports x86, x86_64,
487+ and ARM for now, so that reports from all these architectures can be
488+ retraced on an x86_84 machine. (LP: #1044437)
489+ * launchpad.py: Add "architecture" option to process reports for a foreign
490+ architecture.
491+ * Add exceptions from package hooks to new HookError_<filename> report field,
492+ to make them more visible. Until now they were only written to stderr.
493+ (LP: #1086309)
494+
495+Bug fixes:
496+ * Fix test_find_package_desktopfile test to not consider packages with only
497+ one "NoDisplay=true" .desktop file for the "has one desktop file" test.
498+ * report.py, mark_ignore(): Use home directory of actual effective user, not
499+ of $HOME. Fixes ignore file when using through sudo.
500+ * apport-cli: Fix showing of prompt. Thanks Dmitry Shachnev!
501+ * fileutils.py, mark_report_upload(): Do not try to remove the .uploaded file,
502+ as this is not owned by the user.
503+ * backends/packaging-apt-dpkg.py, install_packages(): Set mirror to the one in
504+ the sandbox config.
505+ * apportcheckresume: Fix crash if state file does not exist.
506+
507+2.6.3 (2012-11-30):
508+-------------------
509+ * test_signal_crashes.py: Fix incompatibility with Python 3.3.
510+ * test_signal_crashes.py: Allow XDG_RUNTIME_DIR environment variable, as it
511+ only shows whether or not it is set. (Test regression from 2.6)
512+ * debian.py: Only reject reports with useless stack traces if the report
513+ actually has a stack trace at all.
514+ * debian.py: Fix UTF-8 string handling. Thanks Ritesh Raj Sarraf.
515+ * debian.py: Fix crash on broken "Package" fields, as generated by current
516+ Debian/Ubuntu dkms package.
517+ * data/apport: Call fsync when writing upstart crash reports.
518+ * report.py, add_gdb_info(): Handle libnih's assertion messages.
519+ (LP: #997359)
520+ * apport-gtk, apport-kde: Don't provide an option to restart a crashed
521+ application when the crash occurred in a thread (LP: #1033902).
522+ * apport-retrace: Disallow option -C without option -S. Thanks Kyle Nitzsche.
523+ * fileutils.py, mark_report_upload(): Refresh the .upload stamps if a previous
524+ version of the report was already uploaded, but another instance of the
525+ problem happened since then. Thanks Brian Murray. (LP: #1084296)
526+ * Ignore implausibly low addresses when computing StacktraceAddressSignature.
527+ These are usually artifacts from gdb when not having debug symbols, and
528+ having too many of them prevents proper client-side duplicate detection and
529+ proper bucketing in daisy. (LP: #1084996)
530+ * fileutils.py: Ignore .desktop files with NoDisplay=true. (LP: #1048524)
531+
532+2.6.2 (2012-11-06):
533+-------------------
534+ * problem_report.py: Fix UnicodeDecodeError crash under Python 2 when the
535+ report has an unicode field with an unprintable ASCII character < 20.
536+ * debian.py: Fix calling of parent accepts() method and return value. Thanks
537+ Ritesh Raj Sarraf.
538+ * bin/apport-retrace: Fix crash when not using --sandbox mode.
539+ * report.py, add_proc_info(): Throw correct exception if the executable path
540+ does not exist, to provide a more appropriate error message. (LP: #1065129)
541+ * report.py, add_gdb_info(): Check __glib_assert_msg for assertion messages,
542+ too.
543+ * REThread.py: Fix for Python 3.3.
544+
545+2.6.1 (2012-10-01):
546+-------------------
547+ * setup.py: Specify "-source 1.5" javac option as well, to avoid build failure
548+ with OpenJDK 7.
549+
550+2.6 (2012-10-01):
551+-----------------
552+ * setup.py: Build java module with "-target 1.5" option, so that you can run
553+ it with OpenJDK 6 even if you build with OpenJDK 7.
554+ * report.py, add_proc_info(): Show if $XDG_RUNTIME_DIR is set.
555+ * Add apport/crashdb_impl/debian.py: Initial crash database implementation for
556+ the Debian BTS. Add configuration for it to etc/apport/crashdb.conf. Thanks
557+ Ritesh Raj Sarraf!
558+ * test_python_crashes.py: Robustify "$PYTHONPATH in ProcEnviron" check.
559+
560+2.5.3 (2012-09-28):
561+-------------------
562+ * data/apportcheckresume: Open report file in binary mode. (LP: #1040353)
563+ * packaging-apt-dpkg.py: When throwing ValueErrors, show the non-existing
564+ package name. This makes it easier to debug such crashes.
565+ * launchpad.py: Replace characters from tags which are not allowed by
566+ Launchpad with '.' (LP: #1029479)
567+ * launchpad.py: Temporarily disable filing private bugs in the test suite, to
568+ work around the SSLHandshakeError error when downloading private attachments
569+ from staging.
570+ * hookutils.py, attach_root_command_outputs(): Ignore IOError crash about
571+ nonexisting files, which can happen if the user dismisses authorization.
572+ (LP: #1051222)
573+ * report.py, search_bug_patterns(): Fix bug patterns containing non-ASCII
574+ characters. Thanks Brian Murray.
575+ * apport_python_hook.py: Capture $PYTHONPATH and $PYTHONHOME environment
576+ variables for Python crashes. Thanks Brian Murray.
577+
578+2.5.2 (2012-09-17):
579+-------------------
580+ * test/run: Ignore root_info_wrapper with pyflakes.
581+ * packaging-apt-dpkg.py: Add recommended packages to "Dependencies:" field.
582+ (LP: #1014428)
583+ * test_hookutils.py, test_in_session_of_problem(): Use year 2038 for a future
584+ date instead of 2211, as current Python 3.2 now crashes with an
585+ OverflowError on 32 bit machines with later years.
586+ * Fix crash on broken .desktop files. (LP: #1039889)
587+ * apport-gtk: For console program crashes, say "stopped" instead of "closed".
588+ Add a subtitle label with a hint about hanging programs. Thanks Matt Price
589+ and Matthew Paul Thomas!
590+ * report.py: Fix crash on determination of Python module path when examining a
591+ crash of "python -m ...".
592+ * apport-kde: Fix crash with undefined QString under Python 3. Thanks Jonathan
593+ Riddell! (LP: #1028984)
594+ * launchpad.py: Add missing "Pre-release Freeze" status. Thanks Brian Murray!
595+ * report.py, _check_bug_pattern(): Fix bug pattern matching against binary
596+ values. Thanks Brian Murray for the original patch. (LP: #1016380)
597+
598+2.5.1 (2012-08-22):
599+-------------------
600+ * data/root_info_wrapper: Turn into a real file, a symlink can cause some
601+ packaging problems.
602+
603+2.5 (2012-08-22):
604+-------------------
605+Bug fixes:
606+ * test_recoverable_problem.py: Fix test for calling test runner with absolute
607+ path.
608+ * packaging-apt-dpkg.py: Fix crash on writing virtual_mapping.db when running
609+ with --sandbox-dir and -S system or giving no --cache.
610+ * REThread.py: Fix re-raising of exceptions in Python 3. Thanks Martin
611+ Packman! (LP: #1024836)
612+ * apport-retrace: Keep compressed CoreDump from .crash files instead of
613+ uncompressing them into memory. This dramatically reduces memory usage.
614+ (LP: #981155)
615+
616+Improvements:
617+ * Add an apport.memdbg() function which prints out current memory usage if
618+ APPORT_MEMDEBUG is set. Annotate apport-retrace with it.
619+ * hookutils.py: Allow specifying a list of profile names when using
620+ attach_mac_events(). Thanks Marc Deslauriers.
621+ * hookutils.py, attach_root_command_outputs() and root_command_output(): Drop
622+ usage of sudo, kdesudo, and gksu, and replace with pkexec. For
623+ attach_root_command_outputs(), use a wrapper and proper .policy file which
624+ explains the action and works under every environment; thus
625+ attach_root_command_outputs() is preferred over root_command_output() now,
626+ as it provides a better user experience.
627+ * Package hooks which want to send the report to a different crash database
628+ than "default" can now also give the database specification itself in the
629+ "CrashDB" field, not just the DB name. With this, packages do not need to
630+ ship a separate /etc/apport/crashdb.conf.d/ file. Please see
631+ doc/package-hooks.txt for details. (LP: #551330)
632+ * report.py, add_hooks_info(): If reporting against a package/program in /opt,
633+ also search for package hooks in the corresponding /opt directory. This
634+ allows such hooks to define a custom crash database and thus report bugs
635+ against their own project instead of against the distribution.
636+ (LP: #1020503)
637+
638+2.4 (2012-07-18):
639+-----------------
640+Improvements:
641+ * apport_python_hook.py: For org.freedesktop.DBus.Error.ServiceUnknown
642+ exceptions, add a 'DbusErrorAnalysis' field to the report which points out
643+ whether any .service file provides the service it tried to talk to, and
644+ whether the processes for those are running. This helps to determine the
645+ root cause for such errors (missing dependencies, broken .service files,
646+ talking to the wrong bus, etc.) (LP: #1020572)
647+ * hookutils.py, attach_alsa(): Use alsa-info.sh when available. Thanks David
648+ Henningson.
649+ * Add new "RecoverableProblem" report type for problems which the application
650+ can handle, but still wishes to notify the user and send a problem report
651+ about. As an example, the application may wish to notify the user because
652+ handling the error resulted in degraded functionality. The user interface
653+ may fail to load items, or the action just performed may not return any
654+ data. Applications call /usr/share/apport/recoverable_problem with a
655+ string of arbitrary NUL-separated key/value pairs that are added to the
656+ report. Thanks Evan Dandrea!
657+
658+Bug fixes:
659+ * ui tests, test_wait_for_pid(): Fix eternal hang when running as root.
660+ * testsuite: Fix ResourceWarnings when running with Python 3.
661+ * test_python_crashes.py: Fix race condition in timeout test.
662+ * launchpad.py: Fix setting of 'Medium' importance on duplicate checking.
663+ * apport-retrace: Fix StacktraceSource generation for relative --cache paths.
664+ * crashdb.py, check_duplicate(): Do not try to mark a bug as duplicate of
665+ itself. This can happen when re-processing a previously retraced bug.
666+ * apport-retrace: Fix UnicodeDecodeError when encountering a non-ASCII source
667+ code file and running under a non-UTF-8 locale.
668+
669+2.3 (2012-07-09):
670+-----------------
671+Improvements:
672+ * launchpad.py: Rework test suite to not use Launchpad's +storeblob facility
673+ at all any more. It almost never works on staging and is horribly slow. Fake
674+ the bug creation from a blob by manually creating the comment and
675+ attachments ourselves, and just assume that storeblob works on production.
676+ Also change the structure to allow running every test individually.
677+ * crash-digger: Add --crash-db option to specify a non-default crash databae
678+ name. (LP: #1003506)
679+ * apport-gtk: Add --hanging option to specify the process ID of a hanging
680+ application. If the user chooses to report this error, apport will terminate
681+ the pid with SIGABRT, otherwise it will send SIGKILL. The normal core pipe
682+ handler will be used to process the resulting report file, with a .hanging
683+ file in /var/crash to separate these from regular crashes.
684+
685+Bug fixes:
686+ * apport: Also treat a binary as modified if the /proc/pid/exe symlink does
687+ not point to an existing file any more. (LP: #984944)
688+ * Fix PEP-8 violations picked up by latest pep8 checker.
689+ * ui.py: Do not ignore certain exceptions during upload which are not likely
690+ to be a network error.
691+ * launchpad.py: Recongize Launchpad projects for bug query and marking
692+ operations. (LP: #1003506)
693+ * packaging-apt-dpkg.py: Fix get_source_tree() to work with apt sandboxes.
694+ * apport-retrace: Turn StacktraceSource generation back on, now that it works
695+ with the current sandboxing.
696+ * launchpad.py: Ensure that upload chunk size does not underrun. (LP: #1013334)
697+ * apport_python_hook: Fix UnicodeEncodeError crash with Python 2 for
698+ exceptions with non-ASCII characters. (LP: #972436)
699+ * test_ui_kde.py: Fix occasional test failure in test_1_crash_details if the
700+ application ends before the "is progress bar visible" check is done.
701+
702+2.2.5 (2012-06-21):
703+-------------------
704+ * launchpad.py: Fix str vs. bytes crash for already known bugs, take 2. (LP: #1015788)
705+ * apport/ui.py, get_desktop_entry(): Disable interpolation, to correctly read
706+ desktop files with % signs. (LP: #1014341)
707+ * apport/ui.py: Fix rare crash if a report is already being updated in the
708+ background when the UI tries to update a previous version. (LP: #949196)
709+ * GTK and KDE UI tests: Avoid eternal hangs due to "this is not a distro
710+ package" error messages.
711+
712+2.2.4 (2012-06-21):
713+--------------------
714+Bug fixes:
715+ * test_apport_unpack.py: Fix test_unpack_python() test when running the
716+ system-installed tests.
717+ * data/java_uncaught_exception: Fix for Python 3.
718+ * test_signal_crashes.py: Show crash reports in /var/crash/.
719+ * test_crash_digger.py: Do not write crash reports of crash-digger into system
720+ /var/crash, use a temporary directory.
721+ * test/run: Wait for a previous xvfb server to finish before trying to start
722+ one. This fixes a race condition in the KDE UI tests which often failed to
723+ start up xvfb.
724+ * apport-cli: Unbreak "keep" option. (LP: #1007826)
725+ * launchpad.py: Fix str vs. bytes crash for already known bugs. (LP: #1015788)
726+
727+2.2.3 (2012-06-15):
728+-------------------
729+Bug fixes:
730+ * test/run: Do not run pep8 and pyflakes when running against the sytem
731+ installed Apport.
732+ * test_backend_apt_dpkg.py: For the "are we online" check, verify that we can
733+ download from http://ddebs.ubuntu.com/, not just whether we have a default
734+ route. The latter is not sufficient for e. g. buildd environments which are
735+ online, but are restricted by proxies or firewalls.
736+ * test_report.py: Call "sync" after test script write core dumps, to ensure
737+ that subsequent operations have a complete one.
738+ * test_signal_crashes.py: Drop the broken and obsolete test_local_python()
739+ test. Instead, add two tests which check proper logging.
740+ * launchpad.py: Fix urlopen() for Python3. Thanks Steve Langasek.
741+ * test/run: Run the tests under LC_MESSAGES=C, to avoid failing tests on
742+ translated strings.
743+
744+2.2.2 (2012-06-13):
745+-------------------
746+Improvements:
747+ * testsuite: Run with Python 3 by default. To test with Python 2, run
748+ "PYTHON=python2 test/run".
749+
750+Bug fixes:
751+ * apport: Redefine sys.std{out,err} when redirecting output, as they are None
752+ in Python 3 when being called from the kernel.
753+ * test/test_signal_crashes.py: Clean up unexpected core dumps on failed test
754+ cases.
755+ * apport-gtk: Fix crash when closing the crash dialog while the information is
756+ being collected.
757+ * hookutils.py, xsession_errors(): Fix crash when running under a non-UTF8 locale.
758+ * data/apport: Do not use sys.stdin.fileno(), it is invalid when being called
759+ from the kernel with Python 3.
760+ * data/apport: When core dumps are enabled, read them from the written report
761+ instead of directly from stdin (and then reading the written core file into
762+ the .crash report). If the core file size is limited, we otherwise stop
763+ reading the core dump from the kernel in the middle and have no (or a
764+ broken) core dump to be put into the report.
765+ * data/apport: Properly close the written crash report before changing its
766+ permissions to be readable. This prevents having crash reporting UI from
767+ looking at incomplete .crash files.
768+
769+2.2.1 (2012-06-11)
770+------------------
771+Bug fixes:
772+ * apport-cli: Port to work with Python 3.
773+ * setup.py: When fixing hashbang lines of installed scripts, only include the
774+ major Python version.
775+ * hookutils.py, read_file, attach_file(), attach_file_if_exists(): Convert
776+ file contents to unicode if the contents is UTF-8, or the newly added
777+ force_unicode argument is True.
778+ * hooktuils, command_output(): Convert output to unicode by default, and add
779+ a "decode_utf8" parameter to disable this.
780+ * hookutils.py, recent_logfile(): Fix fd leak.
781+ * data/apport: Do not assume that sys.stdout and sys.stderr always have a
782+ name; they can be None in Python 3.
783+ * data/dump_acpi_tables.py: Fix for Python 3.
784+
785+2.2 (2012-06-11)
786+----------------
787+Improvements:
788+ * Clean up module imports.
789+ * test/run: Run pyflakes, if available.
790+ * package_hook: Add --tags option. Thanks to Brian Murray.
791+ * launchpad.py: Drop the external multipartpost_handler.py (which is not
792+ portable to Python 3) and replace it with using the standard email module.
793+ * launchpad.py: Also work with Python 3. Deal gracefully with a missing
794+ "launchpadlib" module; this is not yet available for Python 3, but not
795+ required for client-side reporting.
796+ * apport-kde: Port to work with Python 3.
797+
798+Bug fixes:
799+ * apport-retrace: Fix crash when using the --procmaps option.
800+ * setup.py: Update hashbang lines of installed scripts in data directory to
801+ the python executable setup.py was run with, similar to what already happens
802+ to scripts installed to ../bin/.
803+
804+2.1.1 (2012-05-30)
805+------------------
806+Improvements:
807+ * launchpad.py: When closing a bug as a duplicate, copy some well-known tags
808+ to the master bug. Thanks Brian Murray.
809+ * launchpad.py: Set importance of Python crash reports to "Medium" by default,
810+ similar to signal crashes. Thanks Brian Murray.
811+ * hookutils.py: Add attach_default_grub() convenience function from the grub2
812+ package hook so it can be used by other packages. Thanks Brian Murray.
813+ * launchpad.py: Make Launchpad bug subscription user/team configurable: The
814+ initial subscriber after filing a bug can be set with the
815+ "initial_subscriber" crashdb option, and the team which gets subscribed
816+ after retracing with "triaging_team". (LP: #980726)
817+
818+Bug fixes:
819+ * report.py: Do not change the SourcePackage: field if the binary package is
820+ not installed and does not exist. This fixes source package hooks to
821+ actually work in some cases where source and binary package names overlap.
822+ (part of LP: #993810)
823+ * apport-gtk, apport-kde: Avoid collecting information twice in "bug update"
824+ mode. This caused a crash in cases where the source package in a bug report
825+ does not correspond to an installed binary package. (LP: #993810)
826+
827+2.1 (2012-05-18)
828+----------------
829+Improvements:
830+ * packaging.py, install_packages(): Add permanent_rootdir flag and if set,
831+ only unpack newly downloaded packages. Implement it for the apt/dpkg
832+ backend. Thanks Evan Dandrea.
833+ * apport-retrace: Add --sandbox-dir option for keeping a permanent sandbox
834+ (unpacked packages). This provides a considerable speedup. Thanks Evan
835+ Dandrea.
836+ * crash-digger: Add --sandbox-dir option and pass it to apport-retrace.
837+ * Fix the whole code to be PEP-8 compatible, and enforce this in test/run by
838+ running the "pep8" tool.
839+ * GTK UI tests: Ensure that there are no GLib/GTK warnings or criticals.
840+ * Support Python 3. Everything except the launchpad crashdb backend now works
841+ with both Python 2 and 3. An important change is that the load(),
842+ write(), and write_mime() methods of a ProblemReport and apport.Report
843+ object now require the file stream to be opened in binary mode.
844+ * data/apport: Ignore a crash if the executable was modified after the process
845+ started. This often happens if the package is upgraded and a long-running
846+ process is not stopped before. (LP: #984944)
847+ * Add test cases for apport-unpack.
848+ * apport-retrace: Add information about outdated packages to the
849+ "RetraceOutdatedPackages" field.
850+ * ui.py: Drop python-xdg dependency, use ConfigParser to read the .desktop
851+ files.
852+
853+Bug fixes:
854+ * apport-gtk: Work around GTK crash when trying to set pixmap on an already
855+ destroyed parent window. (LP: #938090)
856+ * data/dump_acpi_tables.py: Fix crash on undefined variable with non-standard
857+ tables. (LP: #982267)
858+ * backends/packaging-apt-dpkg.py: Fix crash if a package is installed, but has
859+ no candidates in apt. (LP: #980094)
860+ * data/general-hooks/generic.py: Bump minimum free space requirement from 10
861+ to 50 MB. 10 is not nearly enough particularly for /tmp. (LP: #979928)
862+ * hookutils.py, recent_logfile(): Use a default limit of 10000 lines and call
863+ "tail" instead of reading the whole file. This protects against using up all
864+ memory when there are massive repeated log messages. (LP: #984256)
865+ * apport-gtk: Do not assume that an icon requested for size 42 actually
866+ delivers size 42; some themes do not have this available and deliver a
867+ smaller one instead, causing overflows. Also, copy the image as
868+ gtk_icon_theme_load_icon() returns a readonly result which we must not
869+ modify. (LP: #937249)
870+ * ui.py: Don't show the duplicate warning when the crash database does not
871+ accept the problem type, and they are just being sent to whoopsie. Thanks
872+ Evan Dandrea. (LP: #989779)
873+ * report.py: Correctly escape the file path passed to gdb.
874+ * apport-gtk, apport-kde: Do not show the information collection progress
875+ dialog if the crash database does not accept this kind of report. In that
876+ case whoopsie will upload it in the background and the dialog is not
877+ necessary. (LP: #989698)
878+
879+2.0.1 (2012-04-10)
880+------------------
881+Bug fixes:
882+ * test_ui_gtk.py: Disable package hooks for the tests, as they might ask for
883+ sudo passwords and other interactive bits, and thus make the tests hang.
884+ * test_backend_apt_dpkg.py: Fix checks for the installation of -dbgsym
885+ packages. This should always happen, as the sandboxes have a ddeb apt
886+ source. Only make it conditional on the system apt sources in the "use
887+ system config" test.
888+ * test_report.py: Sleep a bit after calling our test crash script, to ensure
889+ the kernel has time to finish writing the core file.
890+ * generic package hook: Also check /tmp for enough space. Thanks Brian Murray.
891+ (LP: #972933)
892+ * problem_report.py, write_mime(): Fix regression from version 1.95: Add a
893+ value as attachment if it is bigger than 1000 bytes, not if it is bigger
894+ than 100. (LP: #977882)
895+
896+Improvements:
897+ * packaging-apt-dpkg.py: Avoid constructing and updating the apt.Cache()
898+ objects multiple times, to speed up retracing. Thanks Evan Dandrea.
899+ (LP: #973494)
900+
901+2.0 (2012-03-30)
902+----------------
903+This is the final 2.0 release, featuring the overhauled and simplified GUI,
904+support for whoopsie-daemon, and client-side duplicate checking.
905+
906+Bug fixes:
907+ - report.py, anonymize(): Only replace whole words, not substrings.
908+ (LP: #966562)
909+ - apport_python_hook.py: Fix filtering of org.freedesktop.DBus.Error.NoReply
910+ exceptions. (LP: #958575)
911+ - crashdb.py: When publishing the crash database, cut hash file names after
912+ quoting, to avoid that the quoting causes them to become too long.
913+ (LP: #968070) This also uncovered that known() did not actually find any
914+ signature which contained an URL-quoted character, therefore breaking
915+ client-side duplicate checking in a lot of cases. Double-quote the file name
916+ now, as urlopen() unquotes it.
917+ - Add a new crash database option "problem_types" and a CrashDatabase method
918+ "accepts(report)". This can be used to stop uploading particular problem
919+ report types to that database. E. g. a distribution might decide to not get
920+ "Crash" reports any more after release. Document the new option in
921+ doc/crashdb-conf.txt.
922+ - ui.py: Do not upload a report if the crash database does not accept the
923+ report's type. This behaviour is not really correct, but necessary as long
924+ as we only support a single crashdb and have whoopsie hardcoded. Once we
925+ have multiple crash dbs, we need to not even present the data if none of the
926+ DBs wants the report. See LP #957177 for details. (LP: #968121)
927+ - ui.py: Do not short-circuit information collection if report already has a
928+ "DistroRelease" field, as the GUIs add that in some cases. Check for
929+ "Dependencies" instead. This fixes information collection for kernel
930+ problems (which now has a full GTK GUI test case). (LP: #968488)
931+
932+1.95 (2012-03-22)
933+-----------------
934+Bug fixes:
935+ - ui.py: Ensure that the report file is readable by the crash reporting daemon
936+ after running through collect_info(). Thanks Evan Dandrea.
937+ - apport-gtk, apport-kde: Set the window title to the distribution name, as
938+ per http://wiki.ubuntu.com/ErrorTracker#error . Thanks Evan Dandrea.
939+ (LP: #948015)
940+ - test/run: Ignore obsolete packages on the system, to avoid breaking the GUI
941+ tests due to them.
942+ - apport-gtk, apport-kde: When reporting a "system crash", don't say "... of
943+ this program version", but "...of this type", as we don't show a program
944+ version in the initial dialog (https://wiki.ubuntu.com/ErrorTracker#error)
945+ (LP: #961065)
946+ - problem_report.py, write_mime(): Do not put a key inline if it is bigger
947+ than 1 kB, to guard against very long lines. (LP: #957326)
948+ - etc/cron.daily/apport: Do not remove whoopsie's *.upload* stamps every day,
949+ only if they are older than a week. whoopsie comes with its own cron job
950+ which deals with them. Thanks Steve Langasek. (LP: #957102)
951+ - report.py, mark_ignore(): Fix crash if executable went away underneath us.
952+ (LP: #961410)
953+ - apport-gtk: Do not compare current continue button label against a
954+ translated string. Instead just remember whether or not we can restart the
955+ application. (LP: #960439)
956+ - hookutils.py, command_output(): Add option to keep the locale instead of
957+ disabling it.
958+ - hookutils.py, command_output(): Actually make the "input" parameter work,
959+ instead of causing an eternal hang. Add tests for all possible modes of
960+ operation.
961+ - hooktuils.py: Change root_command_output() and attach_root_command_outputs()
962+ to disable translated messages (LC_MESSAGES=C) only as part of the command
963+ to be run, not already for the root prefix command. This will keep the
964+ latter (gksu, kdesudo, etc.) translated. (LP: #961659)
965+ - apport-gtk: Cut off text values after 4000 characters, as Gtk's TreeView
966+ does not get along well with huge values. KDE's copes fine, so continue to
967+ display the complete value there. (LP: #957062)
968+ - apport-gtk: Make details window resizable in bug reporting mode.
969+ - crashdb.py, known(): Check the address signature duplicate database if the
970+ symbolic signature exists, but did not find any result. (LP: #103083)
971+ - ui.py: Run anonymization after checking for duplicates, to prevent host or
972+ user names which look like hex numbers to corrupt the stack trace.
973+ (LP: #953104)
974+ - apport-gtk: Require an application to both have TERM and SHELL in its
975+ environment to consider it a command line application that was started by
976+ the user. (LP: #962130)
977+ - backends/packaging-apt-dpkg.py, _check_files_md5(): Fix double encoding,
978+ which caused UnicodeDecodeErrors on non-ASCII characters in an md5sum file.
979+ (LP: #953682)
980+ - apport-kde, apport-gtk: Only show "Relaunch" if the report has a
981+ ProcCmdline, otherwise we cannot restart it. (LP: #956173)
982+
983+Improvements:
984+ - hookutils.py, attach_alsa(): Add the full "pacmd list" output instead of
985+ just sinks and sources. Thanks David Henningsson.
986+ - apport-gtk, apport-kde: Show the ExecutablePath while we're collecting data
987+ for the crash report. Thanks Evan Dandrea. (LP: #938707).
988+
989+1.94.1 (2012-03-07)
990+-------------------
991+Bug fixes:
992+ - test_ui_kde.py: Re-enable inadvertently disabled "bug report for uninstalled
993+ package" test.
994+ - ui.py, collect_info(): Do not assume that reports have a "ProblemType"
995+ field. This is not the case when updating a bug. (LP: #947519)
996+ - apport-cli: Consistently handle unicode vs. byte arrays. (LP: #946207)
997+ - report.py, anonymize(): Fix crash when the hostname or user name contain
998+ non-ASCII characters. (LP: #945230)
999+ - packaging-apt-dpkg.py: Fix UnicodeDecodeError on unexpected md5sum output.
1000+ (LP: #921037)
1001+ - apport-gtk: Fix handling of non-ASCII strings in message dialogs.
1002+ (LP: #865394)
1003+
1004+1.94 (2012-03-02)
1005+-----------------
1006+Bug fixes:
1007+ - apport: Set the group of written reports to "whoopsie" if that group exists.
1008+ - Fix tests to run properly against the system-installed modules and binaries.
1009+ - test/run: Run under LC_MESSAGES=C to avoid test failures due to translated
1010+ strings.
1011+ - general-hooks/generic.py: Also attach xsession-errors for programs that link
1012+ to libgtk-3.
1013+ - launchpad.py: Properly handle "Expired" status, to avoid marking new bugs as
1014+ duplicates of expired ones. (LP: #941854)
1015+ - apport: Fix crash if the "whoopsie" group does not exist. (LP: #942326)
1016+ - report.py, crash_signature(): Do not put "<module>" frames into Python crash
1017+ signatures that happen outside of function/method calls. Fall back to the
1018+ file/line number as a frame description instead. This will do a much better
1019+ job at disambiguating e. g. different ImportError crashes. (LP: #920403)
1020+ - Make "binary changed since the time of the crash" error message more
1021+ comprehensible, thanks Paolo Rotolo. (LP: #942830)
1022+ - crashdb.py, check_duplicate(): It can happen that a bug gets identified as
1023+ being a duplicate of bug S by symbolic signatures and a duplicate of bug A
1024+ by address signatures. Empirical evidence shows that this is due to the
1025+ unavoidable jitter in stack traces (A and S not being identified as
1026+ duplicates as their signatures differ slightly) and not a logic error. So
1027+ instead of erroring out, duplicate all three bugs and keep the lowest number
1028+ as the master ID. (LP: #943117)
1029+ - Revert the usage of multiple nested threads during data collection, and
1030+ switch back to only using one UI thread. The UI implementations can, and now
1031+ do, decide between showing a spinner and showing a progress dialog in the
1032+ ui_*_info_collection_progress() methods. This fixes libX11 crashes when
1033+ multiple UI threads do changes concurrently (LP: #901675), and also avoids
1034+ multi-thread induced crashes in Pango (LP: #943661). The removal of the
1035+ collect() method also fixes the new crashes in it. (LP: #942098, #939803)
1036+ - ui.py, get_desktop_entry(): Fix crash on uninstalled package. (LP: #940984)
1037+ - data/unkillable_shutdown: Fix crash on race condition when PID goes away
1038+ while the report is created. (LP: #546369)
1039+ - apport/hookutils.py, pci_devices(): Fix crash on unexpected lines from
1040+ lspci. (LP: #904489)
1041+ - Drop hardcoded "Ubuntu" words again which crept in with the whoopsie support
1042+ merge. Use the DistroRelease: field.
1043+ - apport-kde: Fix Home page URL in KApplication metadata.
1044+ - apport-gtk: Fix resizability and size after hiding details. (LP: #405418)
1045+
1046+Improvements:
1047+ - test/run: Drop "local" argument. This now tests against the source tree when
1048+ run in the source tree root, and against the system libraries/programs when
1049+ run from anywhere else.
1050+ - test/run: Consider command line arguments as test names and only run those
1051+ when given. Also support just running a single test.
1052+ - testsuite: Force the skipping of online tests when $SKIP_ONLINE_TESTS is
1053+ set.
1054+ - hookutils.py, xsession_errors(): Add a reasonable default pattern which
1055+ matches glib-style warnings, errors, criticals etc. and X window errors.
1056+ In data/general-hooks/generic.py, call it with that default instead of the
1057+ rather incomplete custom pattern. (LP: #932660)
1058+ - packaging.py: Add get_package_origin() method, and implement it for
1059+ apt-dpkg.
1060+ - report.py, add_package_info(): Add "[origin: ...]" tag to "Package" and
1061+ "Dependencies" fields for any package which is not native to the
1062+ distribution. If any such package is present, tag the report with
1063+ "third-party-packages" in data/general-hooks/generic.py. (LP: #927912)
1064+ - apport/packaging.py: Add get_uninstalled_package() method as a helper method
1065+ for the test suite. Use it instead of a hardcoded Debian/Ubuntu specific
1066+ name in test/test_hooks.py.
1067+ - test/test_ui_{gtk,kde}.py: Add test cases for complete UI workflow runs for
1068+ reporting a bug against an installed/uninstalled package, and reporting a
1069+ crash with and without showing details. This reproduces the recent crashes
1070+ like LP #901675 or LP #943661.
1071+ - test_ui.py: Add a test case for reporting a complete report on uninstalled
1072+ package. This happens when reporting a problem from a different machine
1073+ through copying a .crash file.
1074+ - test/run: Add a test that there are no hardcoded "Ubuntu" words in the
1075+ source. The code should use the DistroRelease: field or lsb_release.
1076+
1077+1.93 (2012-02-23):
1078+------------------
1079+Bug fixes:
1080+ - apport-gtk: Fix crash on nonexisting icon. Thanks Evan Dandrea.
1081+ (LP: #937354)
1082+ - ui.py, open_url(): Revert back to calling sudo instead of dropping
1083+ privileges ourselves; with the latter, calling firefox as the sudo'ing user
1084+ fails. (LP: #916810, #938128)
1085+ - ui.py: Fix aborting with "AssertionError" if the report is already known,
1086+ but without an URL. (LP: #938778)
1087+ - launchpad.py: If a bug is already known, but the report is private, do not
1088+ send the report. There is little sense piling up lots of duplicates.
1089+ (LP: #938700)
1090+ - test/crash: Fix regression of test_crash_apport(), consider $TERM a
1091+ non-sensitive variable.
1092+ - ui.py: Fix test failures for data collection progress, they are not expected
1093+ to happen for "ProblemType: Crash" any more (happens in the background
1094+ during sending, or if user clicks on "Show Details").
1095+ - test/hooks: Use a package from Debian/Ubuntu main, so that this works better
1096+ during package builds on build servers.
1097+ - test/python: Do not assume that /var/crash/ exists. Use /var/tmp/ for the
1098+ fake binaries instead.
1099+ - data/general-hooks/parse_segv.py: Fix test case name.
1100+ - ui.py: Fix crash on invalid core dumps. (LP: #937215)
1101+ - launchpad.py: Fix crash on unicode report titles. (LP: #896626)
1102+
1103+Improvements:
1104+ - apport-gtk: Show the most interesting fields first in the details view.
1105+ - do-release: Call pyflakes and abort on errors other than unused imports.
1106+ - Move all test suites out of the code modules into test/test_<module>.py.
1107+ This avoids having to load it every time the program runs, and also allows
1108+ running the tests against the installed version of Apport.
1109+ - Clean up the other executable test script in test/* and change them to the
1110+ same structure as the module tests.
1111+
1112+1.92 (2012-02-20):
1113+------------------
1114+Bug fixes:
1115+ - ui.py: Fix wrong creation of "~" folder instead of expanding it to home
1116+ directory when using "Examine locally". Thanks Jason Conti! (LP: #909149)
1117+ - Replace file() calls with open() for Python 3 compatibility. Thanks Colin
1118+ Watson!
1119+ - launchpad.py: Avoid sending tag names with upper case. (LP: #924181)
1120+ - report.py, crash_signature_addresses(): Fix crash if report does not have
1121+ "Signal".
1122+ - apport-gtk: Fix resize handling of expander in details window. Thanks Thomas
1123+ Bechtold! (LP: #930562)
1124+ - Clean up unnecessary imports. Thanks Evan Dandrea!
1125+
1126+Improvements:
1127+ - man/apport-bug.1: Mention where crash files are stored. Thanks David
1128+ Kastrup.
1129+ - hookutils.py, attach_hardware(): Sort ProcModules, thanks Brian Murray.
1130+ - launchpad.py: Keep "Dependencies" attachment in duplicates. Thanks Brian
1131+ Murray.
1132+ - Reorganize the GNOME and KDE user interface to do the crash notifications
1133+ and detail browser in a single dialog. Add test/gtk and test/kde tests to
1134+ check expected dialog layout for different cases. Thanks Evan Dandrea!
1135+ - Add support for the whoopsie-daisy crash reporting daemon by creating
1136+ zero-byte .upload file stamps for crash reports. Thanks Evan Dandrea!
1137+
1138+1.91 (2012-01-18):
1139+------------------
1140+Bug fixes:
1141+ - crashdb.py, check_duplicate(): If a crash has a signature but no existing
1142+ duplicate in the DB, also check for an existing address signature duplicate
1143+ in the DB.
1144+ - apport-retrace: Use DistroRelease specific subdirectory of the cache dir for
1145+ mapping a file to a package, as these maps are release specific.
1146+ - packaging-apt-dpkg.py: Refresh Contents.gz cache if it is older than one
1147+ day.
1148+ - crashdb.py: Ensure that address_signature duplicate db table does not have
1149+ multiple identical signatures by making it a primary key. Bump the db format
1150+ to "3". Existing databases need to be migrated manually as SQLite does not
1151+ allow adding a "PRIMARY KEY" constraint to existing tables.
1152+ - crashdb.py: Do not add a new address signature entry if one already exists.
1153+ - apport-cli: Fix UnicodeDecodeError on unicode report values. (LP: #275972)
1154+ - launchpad.py: Only set bug task importance if it is undecided.
1155+ - apport-retrace: Fix "an useful" typo. (LP: #911437)
1156+ - report.py: Filter out frames which are internal kernel/glibc implementation
1157+ details and not stable across duplicates. In particular, filter out
1158+ __kernel-syscall() and the SSE stubs.
1159+ - crashdb.py: Remove debugging leftover which completely disabled bug pattern
1160+ checking.
1161+ - report.py: Update reading AssertionMessage. Current (e)glibc turned
1162+ __abort_msg from a simple static string into a struct.
1163+
1164+Improvements:
1165+ - Change permissions of .crash files from 0600 to 0640, so that /var/crash can
1166+ be made g+s and crash handling daemons can access those.
1167+ - Python exceptions: Blacklist DBus.Error.NoReply. It does not help to get
1168+ these traces from the client-side application, you need the actual exception
1169+ in the D-Bus server backend instead. (LP: #914220)
1170+ - Support /etc/apport/whitelist.d/ similarly to /etc/apport/blacklist.d/, for
1171+ cases like installer environments where only crashes of a few selected
1172+ programs should be reported.
1173+
1174+1.90 (2011-11-24):
1175+------------------
1176+First beta release of 2.0 which introduces client-side duplicate checking.
1177+
1178+Bug fixes:
1179+ - backends/packaging-apt-dpkg.py: Fix another test case failure when ddeb
1180+ repository is not enabled.
1181+ - backends/packaging-apt-dpkg.py: Fix handling of explicit cache directory
1182+ name when it is a relative path.
1183+ - launchpad.py: Only query for bugs after 2011-08-01, to avoid timeouts.
1184+ - ui.py: Also anonymize standard bug title. (LP: #893863)
1185+ - launchpad.py: Current Launchpad cannot have private bugs which affect
1186+ multiple projects. Fix test suite accordingly.
1187+
1188+Improvements:
1189+ - report.py: Break out new method stacktrace_top_function() from
1190+ standard_title(), so that other parts of the code can use this as well.
1191+ - launchpad.net: When sending retraced results back to the bug report, update
1192+ the topmost function in the bug title. (LP: #869970)
1193+ - report.py, add_gdb_info(): Add a new field "StacktraceAddressSignature"
1194+ which is a heuristic signature for signal crashes. This should be used if
1195+ crash_signature() fails, i. e. the Stacktrace field does not have enough
1196+ symbols. This can be used to check for duplicates on the client side,
1197+ provided that the crash database server supports querying for these.
1198+ Do not expose this field when uploading to crash databases though, as it can
1199+ be recomputed from the already existing information (ProcMaps and
1200+ Stacktrace) and thus would just clutter the reports.
1201+ - crashdb.py: Add a table "version" with the database format version. Add
1202+ automatic upgrading to the most current format.
1203+ - crashdb.py: Put address signatures from reports checked with
1204+ check_duplicate() into the duplicate database, so that implementations of
1205+ known() can check for these.
1206+ - dupdb-admin: Add "publish" dupdb-admin command which exports the
1207+ duplicate database into a set of text files suitable for WWW publishing.
1208+ - crashdb.py: Add new method "known(report)" which can be implemented to check
1209+ if the crash db already knows about the crash signature. If so, the report
1210+ will not be uploaded, and instead the user will be directed to the existing
1211+ report URL (if available), similar to bug patterns. The default
1212+ implementation checks this format, if the crash database is initialized with
1213+ a "dupdb_url" option pointing to the exported database.
1214+ - launchpad.py: Override known() to check if the master bug is actually
1215+ accessible by the reporter, and is not tagged with "apport-failed-retrace"
1216+ or "apport-request-retrace"; otherwise file it anyway.
1217+ - crash-digger: Add --publish-db option to conveniently integrate duplicate DB
1218+ publication (similar to dupdb-admin publish) into retracer setups.
1219+ - launchpad.py: Attach updated stack traces from a duplicate to the master bug
1220+ if it failed retracing previously or has an "apport-request-retrace" tag.
1221+ (LP: #869982)
1222+ - apport-kde, apport-gtk: Support the "Annotation" field for custom dialog
1223+ titles for "Crash" and "Package" problem types as well, not just for
1224+ "Kernel". (LP: #664378)
1225+
1226+1.26 (2011-11-11):
1227+------------------
1228+Bug fixes:
1229+ - backends/packaging-apt-dpkg.py: Port to current python-apt API.
1230+ - hookutils.py: Fix path_to_key() to also work with unicode arguments.
1231+ - test/crash: Exit successfully if apport is not enabled in the system. This
1232+ allows packages to run the test suite during build.
1233+ - report.py, add_proc_info(): Correctly handle "python -m <modulename>"
1234+ programs as being interpreted and determine the appropriate module path.
1235+ - Fix some import statements to also work for the system-installed test suite.
1236+ - test/run: Fix testing data/general-hooks/parse_segv.py when called in
1237+ system-installed mode.
1238+ - apport/ui.py: Clean up test .crash file after test cases.
1239+ - Fix tests when running as root.
1240+ - setup.py: Fix crash when "javac -version" fails.
1241+ - README: Update command for one-time enablement.
1242+ - backends/packaging-apt-dpkg.py: Fix interleaving usage of install_packages()
1243+ with other operations such as get_version(), by resetting the apt status
1244+ after building and using the sandbox.
1245+ - report.py test suite: Remove requirement that $USER is set, which makes it
1246+ easier to run this from package build environments.
1247+ - apport/ui.py, test/crash: Use "yes" as test process instead of "cat". The
1248+ former is less likely to run already, and does not depend on having a stdin,
1249+ so it runs better in test environments like autopkgtest.
1250+ - backends/packaging-apt-dpkg.py: Fix tests if system does not have a dbgsym
1251+ apt source.
1252+
1253+Improvements:
1254+ - Ignore a crash if gnome-session is running and says that the session is
1255+ being shut down. These often die because X.org or other services are going
1256+ away, are usually harmless, and just cause a lot of clutter in bug trackers.
1257+ (LP: #460932)
1258+ - test/crash: Rewrite using Python's unittest, to be in line with other tests,
1259+ and be easier to maintain and extend.
1260+
1261+1.25 (2011-11-02):
1262+------------------
1263+Improvements:
1264+ - Add new response "Examine locally" to presenting the report details, which
1265+ runs apport-retrace in the chosen mode in a terminal. This should be made
1266+ available for crash reports if apport-retrace and a Terminal application are
1267+ installed; add an abstrace UI method for this. (LP: #75901)
1268+ - apport-gtk: Add "Examine locally..." button, and implement
1269+ ui_run_terminal().
1270+ - apport-cli: Add "Examine locally..." responses, and implement
1271+ ui_run_terminal().
1272+ - apport-cli: Greatly speed up displaying large reports. This also changes the
1273+ format to avoid indenting each line with a space, and visually set apart the
1274+ keys in a better way.
1275+ - apport_python_hook.py: Move tests out of this file into test/python, to
1276+ avoid having to parse the unit tests at each Python startup.
1277+ - test/python: Also make tests work if Python hook is not installed in
1278+ system's sitecustomize.py.
1279+ - packaging.py: Add get_modified_conffiles() API, and implement it in
1280+ packaging-apt-dpkg.py.
1281+ - hookutils.py: Add attach_conffiles().
1282+ - hookutils.py: Add attach_upstart_overrides().
1283+
1284+Bug fixes:
1285+ - launchpad.py: Remove "Ubuntu" in bug response, replace with "this software".
1286+ (LP: #883234)
1287+ - apport-kde: Rearrange order of imports to get intended error message if
1288+ PyKDE is not installed.
1289+ - packaging-apt-dpkg.py: Ignore hardening-wrapper diversions, to make
1290+ gcc_ice_hook work if hardening-wrapper is installed.
1291+ - apport_python_hook: Respect $APPORT_REPORT_DIR.
1292+ - apport_python_hook: Limit successive crashes per program and user to 3 per
1293+ day, just like signal crashes. (LP: #603503)
1294+ - packaging-apt-dpkg.py: Skip online tests when there is no default route.
1295+ - ui.py: Fix test suite to not fail if system has some obsolete or non-distro
1296+ packages.
1297+
1298+1.24 (2011-10-19):
1299+------------------
1300+Bug fixes:
1301+ - backends/packaging-apt-dpkg.py, install_packages(): Also copy
1302+ apt/sources.list.d/ into sandbox.
1303+ - backends/packaging-apt-dpkg.py, install_packages(): Install apt keyrings
1304+ from config dir or from system into sandbox. (LP: #856216)
1305+ - packaging.py, backends/packaging-apt-dpkg.py: Define that install_packages()
1306+ should return a SystemError for broken configs/unreachable servers etc., and
1307+ fix the apt/dpkg implementation accordingly.
1308+ - apport-retrace: Don't crash, just give a proper error message if servers are
1309+ unreachable, or configuration files are broken. (LP: #859248)
1310+ - backends/packaging-apt-dpkg.py: Fix crash when /etc/apport/native-origins.d
1311+ contains any files. (LP: #865199)
1312+ - hookutils, recent_logfile(): Fix invalid return value if log file is not
1313+ readable. (LP: #819357)
1314+ - test/crash: Fix race condition in the "second instance terminates
1315+ immediately" check.
1316+ - hookutils.py: Replace attach_gconf() with a no-op stub. It used static
1317+ python modules like "gconf" which broke the PyGI GTK user interface, and
1318+ gconf is rather obsolete these days.
1319+ - ui.py, open_url(): Greatly simply and robustify by just using xdg-open. This
1320+ already does the right thing wrt. reading the default browser from GNOME,
1321+ KDE, XCE, and other desktops. (LP: #198449)
1322+ - data/general-hooks/generic.py: Only attach ~/.xsession_errors if the bug is
1323+ reported in the same XDG session as the crash happened. (LP: #869974)
1324+ - Ignore crashes for programs which got updated in between the crash and
1325+ reporting. (LP: #132904)
1326+ - Special-case crashes of 'twistd': Try to determine the client program and
1327+ assign the report to that, or fail with an UnreportableReason. (LP: #755025)
1328+ - apport-gtk: In bug update mode, make details dialog resizable and fix
1329+ default size. (LP: #865754)
1330+ - apport-gtk: Fix crash if report does not have ProcCmdline. (LP: #854452)
1331+ - hookutils.py, attach_wifi(): Anonymize ESSID and AP MAC from "iwconfig"
1332+ output. (LP: #746900)
1333+ - test/crash: Fix test failure if user is not in any system groups.
1334+ - test/crash: Change to /tmp/ for test crash process, to fix failure if the
1335+ user that runs the test suite cannot write into the current directory.
1336+ (LP: #868695)
1337+ - ui.py: Improve error message if package is not a genuine distro package.
1338+ Thanks to Ronan Jouchet. (LP: #559345)
1339+
1340+Improvements:
1341+ - apport-retrace: Add --timestamp option to prepend a timestamp to log
1342+ messages. This is useful for batch operations.
1343+ - crash-digger: Call apport-retrace with --timestamps, to get consistent
1344+ timestamps in log output.
1345+ - hookutils.py: Add two new functions attach_gsettings_package() and
1346+ attach_gsettings_schema() for adding user-modified gsettings keys to a
1347+ report. (LP: #836489)
1348+ - hookutils.py: Add new function in_session_of_problem() which returns whether
1349+ the given report happened in the currently running XDG session. This can be
1350+ used to determine if e. g. ~/.xsession-errors is relevant and should be
1351+ attached.
1352+
1353+1.23.1 (2011-09-29)
1354+-------------------
1355+Bug fixes:
1356+ - apport/crashdb.py: Ensure that duplicate table only has one entry per report
1357+ ID.
1358+ - apport-retrace: Pass correct executable path to gdb in --gdb with --sandbox
1359+ mode.
1360+ - apport-retrace: Do not leave behind temporary directories on errors.
1361+ - apport-retrace: Drop assertion failure for existance of "Stacktrace". This
1362+ isn't present in the case of gdb crashing, and there is not much we can do
1363+ about it. This should not break the retracer.
1364+ - apport/report.py: Unwind XError() from stack traces for the "StacktraceTop"
1365+ field, as they take a significant part of the trace. This causes bugs to be
1366+ duplicated which really have different causes.
1367+
1368+1.23 (2011-09-14)
1369+-----------------
1370+Improvements:
1371+ - crashdb.py, crash-digger, dupdb-admin: Drop the concept of "duplicate DB
1372+ consolidation". Such massive queries cause timeouts with e. g. Launchpad.
1373+ Instead, update the status of potential master bugs in the crash DB whenever
1374+ check_duplicate() is called.
1375+
1376+Bug fixes:
1377+ - launchpad.py: Fix crash in close_duplicate() if master bug was already
1378+ marked as a duplicate of the examined bug.
1379+ - problem_report.py, load(): Fix missing last character if the last line in a
1380+ multi-line field is not terminated with a newline.
1381+ - launchpad.py: Fix test_marking_python_task_mangle() check to work with
1382+ current Launchpad.
1383+ - apport-retrace: If the user did not specify a --cache directory, create a
1384+ shared one instead of letting the two install_packages() calls create their
1385+ own. This ensures that the apt and dpkg status is up to date, and avoids
1386+ downloading the package indexes multiple times. (LP: #847951)
1387+ - apport-retrace: Give proper error mesage instead of AssertionError crash if
1388+ a report does not contain standard Apport format data. (LP: #843221)
1389+ - fileutils.py, get_new_reports(): Fix crash if report file disappears in the
1390+ middle of the operation. (LP: #640216)
1391+ - apport/ui.py, load_report(): Intercept another case of broken report files.
1392+ (LP: #445142)
1393+ - apport/report.py, standard_title(): Escape regular expression control
1394+ characters in custom exception names. (LP: #762998)
1395+
1396+1.22.1 (2011-09-06)
1397+-------------------
1398+Improvements:
1399+ - dupdb-admin: Add "removeid" command.
1400+
1401+Bug fixes:
1402+ - dupdb-admin: Use the in-memory CrashDB implementation for simple operations
1403+ like dump or changeid, which do not require an actual backend. This makes
1404+ the command work in checkouts without a /etc/apport/crashdb.conf.
1405+ - dupdb-admin: Fix UnicodeEncodeError crash.
1406+ - launchpad.py: Fix crash if a crash report does not have a DistroRelease.
1407+ - Set the default "Apport" title for choice dialogs instead of the default
1408+ apport-gtk title. Thanks Robert Roth. (LP: #608222)
1409+ - apport-gtk: Update markup_escape_text() call to current glib. (LP: #829635)
1410+
1411+1.22 (2011-08-25)
1412+-----------------
1413+Improvements:
1414+ - Completely rework apport-retrace to use gdb's "debug-file-directory" and
1415+ "solib-absolute-prefix" settings and only unpack the necessary packages in a
1416+ temporary directory. This makes it possible to use it in a running system
1417+ without actually touching installed packages, does not need any root
1418+ privileges, and stops the requirement of using chroots with fakechroot and
1419+ fakeroot. This is a lot easier to maintain and use, and a lot faster, too.
1420+ As a consequence, drop the chroot module, and update crash-digger
1421+ accordingly. See "man apport-retrace" for the new usage.
1422+ It is now also easier to port to other packaging backends, as a lot of the
1423+ common logic moved out of the packaging API;
1424+ packaging.install_retracing_packages() got dropped in favor of the simpler
1425+ packaging.install_packages().
1426+ - crash-digger: Show how many bugs are left in the pool with each new retrace.
1427+
1428+Bug fixes:
1429+ - apport-gtk: Fix crash in GLib.markup_escape_text() call, regression from
1430+ 1.21.3. (LP: #828010)
1431+ - launchpad.py: When searchTasks() times out, exit with 99 as this is a
1432+ transient error.
1433+ - crash-digger: Intercept OverflowError from downloaded compressed
1434+ attachments.
1435+
1436+1.21.3 (2011-08-17)
1437+-------------------
1438+Bug fixes:
1439+ - gtk/apport-gtk.desktop.in: Also show in Unity. (LP: #803519)
1440+ - apport-unpack: Fix crash on file errors.
1441+ - Add apport.packaging.get_library_paths() interface and implement it for
1442+ backends/packaging-apt-dpkg.py using dpkg multiarch directories. Use it in
1443+ chroot.py.
1444+ - hookutils.py: Don't attach empty values. Thanks Bryce Harrington.
1445+ (LP: #813798)
1446+ - apport-gtk: Correctly pass message dialog type.
1447+ - apport-gtk: Fix GLib and GObject imports to be compatible with the future
1448+ pygobject 3.0.
1449+
1450+Improvements:
1451+ - hookutils.py: Add attach_mac_events() for reporting logs of MAC systems.
1452+ Looks for AppArmor messages for now. Thanks Marc Deslauriers!
1453+ - hookutils.py, attach_alsa(): Get a list of outputs/inputs that PulseAudio
1454+ knows about, which also shows the currently selected output/input, as well
1455+ as volumes. This should help with "no sound" bug troubleshooting. Thanks
1456+ Luke Yelavich.
1457+
1458+1.21.2 (2011-07-01)
1459+-------------------
1460+Improvements:
1461+ - test/run: Check $PYTHON for using a different Python interpreter (such as
1462+ "python3") for the tests.
1463+ - generic hook: Don't report package installation failures due to segfaulting
1464+ maintainer scripts. We want the actual crash report only. Thanks Brian
1465+ Murray.
1466+ - hookutils.py, attach_wifi(): Also include wpasupplicant logs. Thanks Mathieu
1467+ Trudel-Lapierre!
1468+
1469+Bug fixes:
1470+ - backends/packaging-apt-dpkg.py: Fix crash introduced in 1.21.1's multiarch
1471+ fixes.
1472+ - report.py: Fix bug patterns to correctly match against compressed report
1473+ fields.
1474+
1475+1.21.1 (2011-06-20)
1476+-------------------
1477+Improvements:
1478+ - data/general-hooks/generic.py: Also check for low space on /var. Thanks
1479+ Brian Murray.
1480+ - hookutils.py, attach_file() and attach_file_if_exists(): Add a new
1481+ "overwrite" flag option. If not given, now default to overwriting an
1482+ existing key, as this is usually what you need when attaching files
1483+ (instead of attaching it several times with '_' appended to the keys). You
1484+ can get the old behaviour by setting overwrite=False.
1485+
1486+Bug fixes:
1487+ - When showing the size of the full report, take the compressed size of binary
1488+ values instead of their uncompressed size, as the crash db upload will use
1489+ the compressed values.
1490+ - backends/packaging-apt-dpkg.py: Fix for current dpkg with multiarch support.
1491+ - test/run: Fix the test suite to run against the system installed libraries
1492+ with current Python versions (2.6, 2.7) where __file__ does not work any
1493+ more with imports.
1494+
1495+1.21 (2011-06-08)
1496+-----------------
1497+Improvements:
1498+ - Supply --desktop option to kdesudo to improve the description which program
1499+ is requesting administrative privileges.
1500+ - apport-checkreports: Exit with status 2 if there are new reports, but apport
1501+ is disabled. This helps crash notification GUIs to not display new crash
1502+ reports in that case. Thanks to Michael Vogt for the original patch.
1503+ - Add data/is-enabled: Shell script to check if apport is enabled. Non-Python
1504+ programs (which can't use apport.packaging.enabled() ) can call this instead
1505+ of having to parse /etc/default/apport themselves, and just check the exit
1506+ code. Inspired by original patch from Michael Vogt, thanks!
1507+
1508+Bug fixes:
1509+ - apport-gtk: HTML-escape text for dialogs with URLs. (LP: #750870)
1510+ - dump_acpi_tables.py: Check to see if acpi/tables dir is mounted first.
1511+ Thanks Brian Murray. (LP: #729622)
1512+ - man/apport-cli.1: Document recently added -w/--window option. Thanks Abhinav
1513+ Upadhyay! (LP: #765600)
1514+ - Use kde-open instead of kfmclient to open URLs under KDE. Thanks Philip
1515+ Muškovac. (LP: #765808)
1516+
1517+1.20.1 (2011-03-31)
1518+-------------------
1519+Bug fixes:
1520+ - Add bash completion support for new -w/--window option that was introduced
1521+ in 1.20. Thanks Philip Muškovac.
1522+ - apport-unpack: Fix crash if target directory already exists.
1523+ - Fix crash if UnreportableReason is a non-ASCII string. (LP: #738632)
1524+ - Fix crash if application from desktop name is a non-ASCII string.
1525+ (LP: #737799)
1526+ - unkillable_shutdown: Fix rare crash if ExecutablePath does not exist (any
1527+ more). (LP: #537904)
1528+ - kernel_crashdump: Fix crash if the vmcore file disappeared underneath us.
1529+ (LP: #450295)
1530+ - unkillable_shutdown: Fix crash if the checked process terminated underneath
1531+ us. (LP: #540436)
1532+ - ui.py: Properly raise exceptions from the upload thread that happen at its
1533+ very end. (LP: #469943)
1534+
1535+1.20 (2011-03-17)
1536+-----------------
1537+Improvements:
1538+ - Add support for -w/--window option which will enable user to select a
1539+ window as a target for filing a problem report. Thanks Abhinav Upadhyay for
1540+ the patch! (LP: #357847)
1541+ - Disable the filtering on SIGABRT without assertion messages. Turns out that
1542+ developers want these crash reports after all. (LP: #729223)
1543+ - Add support for a "DuplicateSignature" report fields. This allows package
1544+ hooks to implement custom duplicate problem handling which doesn't need to
1545+ be hardcoded in Apport itself. Update the launchpad backend to tag such bugs
1546+ as "need-duplicate-check".
1547+
1548+Bug fixes:
1549+ - report.py, add_hooks_info(): Properly report TypeErrors from hooks.
1550+ - apport-retrace: Intercept SystemErrors from ill-formed gzip attachments as
1551+ well.
1552+ - Fix crash if crash database configuration does not specify a
1553+ bug_pattern_url. Just assume None. (LP: #731526)
1554+ - If a custom crash database does not specify a bug_pattern_url, fall back to
1555+ using the default database's. (LP: #731526)
1556+ - hookutils.py Update WifiSyslog regex to correctly catch application log
1557+ messages in syslog. Thanks Mathieu Trudel-Lapierre. (LP: #732917)
1558+ - hookutils.py, attach_hardware(): Avoid error message if machine does not
1559+ have a PCI bus. Thanks Marcin Juszkiewicz! (LP: #608449)
1560+ - backends/packaging-apt-dpkg.py: Replace deprecated getChanges() call with
1561+ get_changes().
1562+ - apport-gtk: Fix broken dialog heading if the name of the crashed program
1563+ contains an & or other markup specific characters.
1564+ - apport-gtk: Don't crash if GTK cannot be initialized. This usually happens
1565+ without a $DISPLAY or when the session is being shut down. Just print an
1566+ error message. If there are pending crashes, they will be shown again the
1567+ next time a session starts. (LP: #730569)
1568+
1569+1.19 (2011-02-28)
1570+-----------------
1571+Bug fixes:
1572+ - Update stack unwind patterns for current glib (slightly changed function
1573+ names), and also ignore a preceding '*'. (LP: #716251)
1574+ - Fix crash_signature() to fail if there is an empty or too short
1575+ StacktraceTop.
1576+ - apt backend: Do not generate a warning if the opportunistically added -dbg
1577+ package does not exist.
1578+ - apt backend: Only add -dbg in --no-pkg mode, as there will be conflicts in
1579+ normal package mode.
1580+ - apt backend: Call tar with target cwd instead of using -C; the latter causes
1581+ an extra openat() call which breaks with current fakechroot.
1582+ - launchpad.py: Fix retracer crash if DistroRelease field does not exist.
1583+ - Convert deprecated failIf()/assert_() TestCase method calls to
1584+ assertFalse()/assertTrue().
1585+
1586+Improvements:
1587+ - In apport-bug, if the user specifies a PID referring to a kernel thread,
1588+ do the right thing and file the bug against the kernel
1589+ - In hookutils.attach_dmesg, skip over an initial truncated message if one
1590+ is present (this happens when the ring buffer overflows)
1591+ - Change bug patterns to just use one central file instead of per-package
1592+ files. This allows bug patterns to be written which are not package
1593+ specific, and is easier to maintain as well. IMPORTANT: This changed the
1594+ format of crashdb.conf: bug_pattern_base is now obsolete, and the new
1595+ attribute bug_pattern_url now points to the full URL/path of the patterns
1596+ file. Thanks to Matt Zimmerman!
1597+
1598+1.18 (2011-02-16)
1599+-----------------
1600+Bug fixes:
1601+ - Ensure that symptom scripts define a run() function, and don't show them if
1602+ not.
1603+ - Do not show symptom scripts which start with an underscore. These can be
1604+ used for private libraries for the actual symptom scripts.
1605+ - Update bash completion. Thanks Philip Muškovac.
1606+ - etc/default/apport: Remove obsolete "maxsize" setting. (LP: #719564)
1607+
1608+Improvements:
1609+ - Remove explicit handling of KDE *.ui files in setup.py, as
1610+ python-distutils-extra 2.24 fixes this. Bump version check.
1611+ - hookutils.py: Add attach_root_command_outputs() to run several commands
1612+ at once. This avoids asking for the password several times. (LP: #716595)
1613+
1614+1.17.2 (2011-02-04)
1615+-------------------
1616+Improvements:
1617+ - Be more Python 3 compatible (not fully working with Python 3 yet, though).
1618+ - apt/dpkg backend: Drop support for pre-0.7.9 python-apt API.
1619+ - Add --tag option to add extra tags to reports. (LP: #572504)
1620+
1621+Bug fixes:
1622+ - hookutils.py, attach_dmesg(): Do not overwrite already existing dmesg.
1623+ - hookutils.py: Be more robust against file permission errors. (LP: #444678)
1624+ - ui.py: Do not show all the options in --help when invoked as *-bug.
1625+ (LP: #665953)
1626+ - launchpad.py: Adapt test cases to current standard_title() behaviour.
1627+
1628+1.17.1 (2011-01-10)
1629+-------------------
1630+Bug fixes:
1631+ - Make the GTK frontend work with GTK 2.0 as well, and drop "3.0" requirement.
1632+
1633+1.17 (2010-12-31)
1634+-----------------
1635+Improvements:
1636+ - Better standard bug titles for Python crashes. Thanks Matt Zimmerman!
1637+ (LP: #681574)
1638+ - Add handler for uncaught Java exceptions. There is no integration for
1639+ automatically intercepting all Java crashes yet, see java/README.
1640+ Thanks Matt Zimmerman! (LP: #548877)
1641+
1642+Bug fixes:
1643+ - GTK frontend: Require GTK 3.0.
1644+ - launchpad.py: Default to "production" instance, not "edge", since edge is
1645+ obsolete now.
1646+ - hookutils.py, attach_alsa(): Fix crash if /proc/asound/cards does not exist.
1647+ (LP: #626215)
1648+ - ui.py, format_filesize(): Fix to work with stricter locale.format() in
1649+ Python 2.7. (LP: #688535). While we are at it, also change it to use base-10
1650+ units.
1651+ - hookutils.py, package_versions(): Always include all requested package names
1652+ even if they're unknown to us. Thanks Matt Zimmerman! (LP: #695188)
1653+ - launchpad.py: When updating a bug, also add new tags. Thanks Brian Murray!
1654+
1655+1.16 (2010-11-19)
1656+-----------------
1657+New features:
1658+ - Port GTK frontend from pygtk2 to GTK+3.0 and gobject-introspection.
1659+
1660+Bug fixes:
1661+ - Fix symptoms again. Version 1.15 broke the default symptom directory.
1662+ - Fix memory test case to work with current Python versions, where the SQLite
1663+ integrity check throws a different exception.
1664+
1665+1.15 (2010-11-11)
1666+-----------------
1667+New features:
1668+ - Add dump_acpi_tables.py script. This can be called by package hooks which
1669+ need ACPI table information (in particular, kernel bug reports). Thanks to
1670+ Brad Figg for the script!
1671+ - Order symptom descriptions alphabetically. Thanks to Javier Collado.
1672+ - Check $APPORT_SYMPTOMS_DIR environment variable for overriding the system
1673+ default path. Thanks to Javier Collado.
1674+
1675+Bug fixes:
1676+ - testsuite: Check that crashdb.conf can have dynamic code to determine DB
1677+ names and options.
1678+ - ui.py test suite: Rewrite _gen_test_crash() to have the test process core
1679+ dump itself, instead of using gdb to do it. The latter fails in ptrace
1680+ restricted environments, such as Ubuntu 10.10.
1681+ - packaging-apt-dpkg.py: Fix handling of /etc/apport/native-origins.d to
1682+ actually work. Thanks Steve Langasek. (LP: #627777)
1683+ - apport-kde: Load correct translation catalogue. Thanks Jonathan Riddell.
1684+ (LP: #633483)
1685+ - launchpad.py: Use launchpadlib to file a bug instead of screen scraping.
1686+ The latter was completely broken with current Launchpad, so this makes the
1687+ test suite actually work again. Thanks to Diogo Matsubara!
1688+ - launchpad.py: Change $APPORT_STAGING to $APPORT_LAUNCHPAD_INSTANCE, so that
1689+ you can now specify "staging", "edge", or "dev" (for a local
1690+ http://launchpad.dev installation). Thanks to Diogo Matsubara!
1691+ - backends/packaging-apt-dpkg.py: Fix crash on empty lines in ProcMaps
1692+ attachment.
1693+ - doc/symptoms.txt: Fix typo, thanks Philip Muskovac. (LP: #590521)
1694+ - apport/hookutils.py: rename ProcCmdLine to ProcKernelCmdLine to not wipe
1695+ wipe out /proc/$pid/cmdline information. (LP: #657091)
1696+ - apport/hookutils.py: attach_file() will not overwrite existing report
1697+ keys, instead appending "_" until the key is unique.
1698+ - Fix --save option to recognise ~, thanks Philip Muškovac. (LP: #657278)
1699+ - Remove escalation_subscription from Ubuntu bug DB definition, turned out to
1700+ not be useful; thanks Brian Murray.
1701+ - launchpad.py: Fix APPORT_LAUNCHPAD_INSTANCE values with a https:// prefix.
1702+ - apt backend: Opportunistically try to install a -dbg package in addition to
1703+ -dbgsym, to increase the chance that at least one of it exists. Thanks
1704+ Daniel J Blueman!
1705+
1706+1.14.1 (2010-06-24)
1707+-------------------
1708+Bug fixes:
1709+ - hookutils.py, attach_drm_info(): Sanitize connector names. Thanks Chris
1710+ Halse Rogers! (LP: #597558)
1711+ - bash completion: Complete all path names, apport-bug can be invoked with a
1712+ path to a program. Thanks Philip Muskovac.
1713+
1714+1.14 (2010-06-16)
1715+-----------------
1716+New features:
1717+ - hookutils.py: Add new method attach_drm_info() to read and format
1718+ /sys/class/drm/*.
1719+
1720+Bug fixes:
1721+ - packaging-apt-dpkg.py: Fix deprecated python-apt variables, thanks David
1722+ Stansby. (LP: #591695)
1723+ - launchpad.py: Fix crash on attachments which are named *.gz, but
1724+ uncompressed. (LP: #574360)
1725+ - hookutils.py, attach_gconf(): Fix defaults parsing for boolean keys.
1726+ (LP: #583109)
1727+
1728+1.13.4 (2010-05-04)
1729+-------------------
1730+ - bash completion: Fix error message if /usr/share/apport/symptoms does not
1731+ exist. Thanks Philip Muškovac! (LP: #562118)
1732+ - general-hooks/parse_segv.py: Report stack exhaustion more clearly and
1733+ correctly handle register dereferencing calls.
1734+ - Save/restore environment when calling hooks, in case they change the locale,
1735+ etc. (LP: #564422)
1736+ - hookutils.py, command_output(): Do not set $LC_MESSAGES for the calling
1737+ process/hook, just for the command to be called.
1738+ - ui.py: When displaying strings from system exceptions, decode them into an
1739+ unicode string, to avoid crashing the KDE UI. (LP: #567253)
1740+ - apport-retrace: Fix crash for retracing kernel vmcores, which do not have an
1741+ ExecutablePath.
1742+ - apport-bug manpage: Clarify when apport-collect may be used. Thanks Brian
1743+ Murray! (LP: #537273)
1744+ - generic hook: Check ProcMaps for unpackaged libraries, and ask the user if
1745+ he really wants to continue. If he does, tag the report as "local-libs" and
1746+ add a "LocalLibraries" field to the report with a list of them.
1747+ (LP: #545227)
1748+
1749+1.13.3 (2010-04-14)
1750+-------------------
1751+ - data/general-hooks/parse_segv.py: suggest segv-in-kernel possibility.
1752+ - ui.py: When running as root, only show system crash reports, to avoid
1753+ restarting user programs as root. (LP: #445017)
1754+
1755+1.13.2 (2010-03-31)
1756+-------------------
1757+ - problem_report.py, write_mime(): Add new optional argument "priority_fields"
1758+ for ordering report keys. Patch by Brian Murray, thanks!
1759+ - launchpad.py: Put some interesting fields first in the report, with the new
1760+ priority_fields argument. Patch by Brian Murray, thanks!
1761+ - packaging-apt-dpkg.py, _install_debug_kernel(): Do not crash on an outdated
1762+ kernel, just return that it is outdated. (LP: #532923)
1763+ - launchpad.py test suite: Add "Referer" HTTP header, now required by
1764+ launchpad.
1765+ - launchpad.py: Fix crash if configuration does not have an "escalated_tag"
1766+ option.
1767+ - launchpad.py: Port to launchpadlib 1.0 API, thanks Michael Bienia for the
1768+ initial patch! (LP: #545009)
1769+ - gtk/apport-gtk-mime.desktop.in, kde/apport-kde-mime.desktop.in: Change
1770+ categories so that these do not ever appear in menu editors. (LP: #449215)
1771+ - launchpad.py: Some LP bugs have broken attachments (this is a bug in
1772+ Launchpad itself). Ignore those instead of crashing.
1773+ - apport-gtk: Turn http:// and https:// links into clickable hyperlinks in
1774+ information and error dialogs. (LP: #516323)
1775+ - apport-retrace: Fix crash when trying to rebuild package info for reports
1776+ without an ExecutablePath. (LP: #436157)
1777+ - ui.py: Fix crash when package information cannot be determined due to broken
1778+ apt status. (LP: #362743)
1779+ - ui.py: Fix crash when /etc/apport/crashdb.conf is damaged; print an
1780+ appropriate error message instead. (LP: #528327)
1781+ - data/kernel_crashdump: Fix crash if log file disappeared underneath us.
1782+ (LP: #510327)
1783+ - data/apport: Fix IOError when apport is called with invalid number of
1784+ arguments, and stderr is not a valid fd. (LP: #467363)
1785+ - hookutils.py: Factor out the DMI collection code from attach_hardware()
1786+ into attach_dmi(), and call that in attach_alsa() as well. Thanks to Brad
1787+ Figg for the patch! (LP: #552091)
1788+ - apport/ui.py: Fix the help output if Apport is invoked under an alternative
1789+ name (like apport-collect). (LP: #539427)
1790+
1791+1.13.1 (2010-03-20)
1792+-------------------
1793+Bug fixes:
1794+ - Update parse-segv to handle gdb 7.1 output.
1795+ - Enhance test suite to work with gdb 7.1 as well, and catch future outputs.
1796+ - UI: Add exception string to the "network error" dialog, to better tell what
1797+ the problem is.
1798+ - UI: Add back -p option to apport-collect/apport-update-bug (regression from
1799+ 1.13). (LP: #538944)
1800+ - launchpad.py: Add yet another workaround for LP#336866. (LP: #516381)
1801+ - launchpad.py, download(): Ignore attachments with invalid key names.
1802+ - Fix regression from 1.10 which made it impossible for a package hook to set
1803+ a third-party crash database for non-native packages. (LP: #517272)
1804+ - apport-cli: Create the 'details' string only if user wants to view details,
1805+ and do not show files larger than 1MB. Thanks Scott Moser! (LP: #486122)
1806+ - packaging-apt-dpkg.py: Silence apt.Cache() spewage to stdout with newer
1807+ python-apt versions. (LP: #531518)
1808+
1809+Improvements:
1810+ - unkillable_shutdown: Add list of running processes and blacklisted pids to
1811+ report. (LP: #537262)
1812+ - Sort the report by key in the details view. (LP: #519416)
1813+
1814+1.13 (2010-03-10)
1815+-----------------
1816+New features:
1817+ - Add "unkillable_shutdown" script to collect information about processes
1818+ which are still running after sending SIGTERM to them. This can be hooked
1819+ into e. g. /etc/init.d/sendsigs on Debian/Ubuntu systems.
1820+
1821+Improvements:
1822+ - apport_python_hook.py: Directly check /etc/default/apport instead of
1823+ querying packaging.enabled(), to avoid importing lots of modules for
1824+ non-packaged scripts. Thanks Stuart Colville! (LP: #528355)
1825+
1826+Bug fixes:
1827+ - Fix SegV parser to notice walking off the stack during "call" or "ret"
1828+ (LP: #531672).
1829+ - Fix --help output for bug updating mode (invocation as apport-collect or
1830+ apport-update-bug). (LP: #504116)
1831+ - Fix bug escalation tagging, thanks to Brian Murray.
1832+ - Fix option processing when being invoked as apport-bug. Thanks to Daniel
1833+ Hahler for the patch! (LP: #532944)
1834+
1835+1.12.1 (2010-02-22)
1836+-------------------
1837+Bug fixes:
1838+ - launchpad.py: Do not keep escalating bugs, just escalate at the 10th
1839+ duplicate.
1840+ - Improve error message if a symptom script did not determine a package name.
1841+ (LP: #503834)
1842+ - general-hooks/generic.py: Fix crash on libGL check with empty StacktraceTop.
1843+ - Review and clean up usage of chmod(). This fixes a small race condition in the
1844+ Python exception hook where a local attacker could read the information from
1845+ another user's crash report. (LP: #516029)
1846+ - hookutils, package_versions(): Ignore "None" packages, for more robust
1847+ package hooks. (LP: #518295)
1848+
1849+1.12 (2010-01-20)
1850+-----------------
1851+Improvements:
1852+ - launchpad.py: Add options 'escalation_subscription' and 'escalation_tag' for
1853+ handling bugs with more than 10 duplicates.
1854+ - crashdb.conf: For Ubuntu, escalate bugs with >= 10 duplicates to
1855+ "ubuntu-bugcontrol" and tag them with "bugpattern-needed". (LP: #487900)
1856+ - general-hooks/generic.py: Filter out crashes on missing GLX (LP: #327673)
1857+ - Add bash completion script. Thanks to Philip Muškovac. (LP: #218933)
1858+
1859+Bug fixes:
1860+ - launchpad.py: Drop APPORT_FILES whitelist for download() and instead just
1861+ filter out file extensions that we know about (*.txt and *.gz).
1862+ (LP: #444975)
1863+ - launchpad.py: Do not put the Tags: field into the bug description, since
1864+ they are already proper tags. In download(), convert the real tags back to
1865+ the Tags: field. (LP: #505671)
1866+ - test/crash: Update expected core dump flags for changed rlimit behaviour in
1867+ Linux 2.6.32.
1868+ - launchpad.py: Fix marking of 'checked for duplicate' for bugs with upstream
1869+ tasks.
1870+ - launchpad.py, get_fixed_version(): Do not consider a bug as invalid just
1871+ because it has any invalid distro package task.
1872+
1873+1.11 (2009-12-23)
1874+-----------------
1875+Improvements:
1876+ - Add "--save" UI option to store the collected information into an .apport
1877+ file instead of sending it right away. The file can then later be sent
1878+ through apport-bug. Update manpages accordingly.
1879+ - Update all copyright and description headers and consistently format them.
1880+ - Rename all TestCase classes to "_T", which makes it much easier to run
1881+ individual tests from the command line.
1882+ - Testsuite: Verify that report details are/are not shown. This uncovered that
1883+ details about package installation failures were not shown before sending
1884+ them, which is fixed now.
1885+
1886+Bug fixes:
1887+ - test/hooks: Do not try to add hook information to kernel_crashdump test
1888+ case, since we do not have an UI here. This test case broke when the system
1889+ had an interactive package hook for the kernel.
1890+ - When reporting a bug from a saved .apport file, let the user review/confirm
1891+ the content before sending.
1892+
1893+1.10.1 (2009-12-23)
1894+-------------------
1895+Improvements:
1896+ - Install apport-collect symlink.
1897+ - Update translations from Launchpad.
1898+
1899+Bug fixes:
1900+ - Move all remaining option/argument parsing from apport-bug into ui.py. This
1901+ allows the user to add options to apport-bug/apport-collect, and also avoids
1902+ unwieldy dissection of options/arguments in shell.
1903+
1904+1.10 (2009-12-19)
1905+-----------------
1906+New features:
1907+ - Add a mode for updating an existing problem report to ui.py (-u/--update).
1908+ This is similar to the Ubuntu specific "apport-collect" tool, but
1909+ implemented the right way now: In particular, this has access to the UI and
1910+ thus can use interactive hooks (LP: #385811) and show you what is being sent
1911+ for confirmation/cancelling (LP: #371827)
1912+ - apport-bug: If invoked as "apport-collect" or "apport-update-bug" (i. e.
1913+ through a symlink), run apport in update mode (-u <number>). This provides a
1914+ convenient no-options command line program. Please note that setup.py does
1915+ not currently install such a symlink. Update the apport-bug manpage
1916+ accordingly.
1917+
1918+Improvements:
1919+ - launchpad.py: Use new login_with() to clean up code, and specify allowed
1920+ access levels (WRITE_PRIVATE is the only sensible one anyway). (LP: #410205)
1921+ - New hookutils functions:
1922+ xsession_errors (match lines from ~/.xsession-errors)
1923+ shared_libraries (determine which libraries a binary links with)
1924+ links_with_shared_library (test if a binary links with a particular library)
1925+ - New CrashDatabase API: get_affected_packages(), can_update(), is_reporter()
1926+ - Rename CrashDatabase.update() to update_traces().
1927+ - Add CrashDatabase.update() for adding all new fields of a report. This is
1928+ primarily useful for collecting local standard and package hook data for an
1929+ already existing bug report which was not filed through Apport. This checks
1930+ can_update()/is_reporter() if the user is eligible for updating that
1931+ particular bug. (LP: #485880)
1932+
1933+Bug fixes:
1934+ - Ignore SIGXCPU and SIGXFSZ; thanks to Kees Cook. (LP: #498074)
1935+ - launchpad.py: Do not mark non-Ubuntu bugs as needs-retrace, since there is
1936+ no retracer right now. (LP: #489794)
1937+ - packaging-apt-dpkg.py, install_retracing_packages(): Do not crash on
1938+ malformed Dependencies.txt lines. (LP: #441709)
1939+ - use-local: Fix for new source tree location of "apport" binary.
1940+
1941+1.9.6 (2009-12-01)
1942+------------------
1943+Improvements:
1944+ - Add pm-utils hook to record current operation, so that apportcheckresume can
1945+ check it. Before this was kept in Ubuntu's pm-utils package.
1946+ - general-hooks/generic.py: Check if using ecryptfs, and which directory.
1947+ (LP: #444656)
1948+
1949+Bug fixes:
1950+ - launchpad.py: Ensure that text attachments on initial bug filing are valid
1951+ UTF-8. (LP: #453203)
1952+ - man/apport-retrace.1: Document -R option.
1953+
1954+1.9.5 (2009-11-20)
1955+------------------
1956+Bug fixes:
1957+ - apport-retrace: Fix crash if InterpreterPath/ExecutablePath do not exist.
1958+ - hookutils.py, attach_alsa(): Attach /proc/cpuinfo too, for CPU flags.
1959+ - Fix crash if InterpreterPath does not exist any more at the time of
1960+ reporting. (LP: #428289)
1961+ - apport-gtk: Connect signals properly, to repair cancel/window close buttons.
1962+ (LP: #427814)
1963+ - Update German translations and fix "konnre" typo. (LP: #484119)
1964+
1965+1.9.4 (2009-11-06)
1966+------------------
1967+Bug fixes:
1968+ - Fix crash when ExecutablePath isn't part of a package. (LP: #424965)
1969+ - hookutils.py, attach_hardware(): Anonymize disk labels. Thanks to Marco
1970+ Rodrigues. (LP: #394411)
1971+ - hookutils.py, attach_wifi(): Anonymize encryption key (which appeared in hex
1972+ when being called as root). Thanks to Marco Rodrigues. (LP: #446299)
1973+ - launchpad.py: If unset, set bug task source package also for interpreter
1974+ crashes.
1975+ - apport-gtk: Give details window a minimize/maximize button, which were
1976+ missing in some window managers. Thanks to Marien Zwart. (LP: #447749)
1977+ - apport-kde: Properly terminate program after closing the last dialog.
1978+ (LP: #458662)
1979+ - hookutils.py, attach_alsa(): Attach /proc/asound/version. (LP: #467233)
1980+ - general-hooks/generic.py: Only collect ~/.xsession-errors bits when we have
1981+ an ExecutablePath linked to libgtk.
1982+
1983+1.9.3 (2009-10-14)
1984+------------------
1985+Changes:
1986+ - Drop handling of the APPORT_REPORT_THIRDPARTY environment variable and
1987+ "thirdparty" configuration file option. This has never been documented, and
1988+ conceptually does not work. There is a proper mechanism for this in place
1989+ now, e. g. launchpad.py's "project" option.
1990+
1991+Bug fixes:
1992+ - hookutils.py: Fix error codes from "comm", thanks to Brian Murray.
1993+ - general-hooks/generic.py: Catch xkbcomp error messages. (LP: #431807)
1994+ - launchpad.py: Assert that we have exactly one of "distro" or "project"
1995+ option.
1996+ - doc/crashdb-conf.txt: Improve documentation of crash database options.
1997+ - apport-gtk: Make Cancel/Send buttons focusable. Thanks to Marco Rodrigues.
1998+ (LP: #447780)
1999+
2000+1.9.2 (2009-10-02)
2001+------------------
2002+Improvements:
2003+ - apport-cli: Print the URL and ask whether to open a browser. In many
2004+ situations (such as usage on a server through ssh), it's preferable to not
2005+ open the browser on the reporting computer. Thanks to Matt Zimmerman for the
2006+ initial patch! (LP: #286415)
2007+ - general-hooks/generic.py: Collect important glib errors/assertions (which
2008+ should not have private data) from ~/.xsession-errors (LP: #431807)
2009+ - launchpad.py: Link hardware data submission key if it exists. (LP: #424382)
2010+
2011+Bug fixes:
2012+ - apport-cli: Fix crash with non-ASCII characters in prompts.
2013+ - Fix "apport-bug symptomname" to actually work.
2014+ - launchpad.py: Fix crash on invalid credentials file. Thanks to Marco
2015+ Rodrigues for the initial patch! (LP: #414055)
2016+
2017+1.9.1 (2009-09-22)
2018+------------------
2019+Bug fixes:
2020+ - hookutils.py, attach_hardware(): Do not attach empty Pccardctl*.
2021+ - apport/report.py, add_gdb_info(): Do not throw away stderr from gdb.
2022+ - data/general-hooks/parse_segv.py:
2023+ + Handle arithmetic wrapping correctly.
2024+ + Handle empty base, scale, or index registers in disassembly.
2025+ + Handle in/out ioport faults.
2026+ - Various improvements to user-visible strings, thanks to Marco Rodrigues!
2027+ (LP: #178507)
2028+ - Various apport-retrace robustifications.
2029+ - setup.py: Fix DistUtilsExtra version check. (LP: #428337)
2030+ - hookutils.py, attach_gconf(): Do not overwrite previous values from other
2031+ packages, thanks LoĂŻc Minier!
2032+ - hookutils.py, attach_gconf(): Fix crash with nonexisting <applyto> tags.
2033+
2034+1.9 (2009-09-08)
2035+----------------
2036+New features:
2037+ - Add "do what I mean" mode to command line argument parsing (applies to all
2038+ interfaces: -cli, -gtk, -kde). When giving a single argument and no options,
2039+ determine the most likely mode, like reporting a bug against a symptom,
2040+ package, executable name, or PID.
2041+ - Add program "apport-bug" which determines the most appropriate user
2042+ interface (GTK, KDE, CLI) and files a bug through it, using the single
2043+ argument "do what I mean" mode. This is an improved version of Ubuntu's
2044+ "ubuntu-bug" script.
2045+
2046+Bug fixes:
2047+ - Update apport-cli manpage to current set of options and behaviour. Also
2048+ point out that apport-gtk and apport-kde share the same CLI.
2049+ - setup.py now installs apport-{gtk,kde} into $prefix/share/apport/, they are
2050+ not supposed to be called directly. This also reflects the path which the
2051+ .desktop files expect.
2052+ - setup.py now installs the internal helper scripts like "kernel_crashdump",
2053+ "apport", or "apportcheckresume" into $prefix/share/apport instead of
2054+ $prefix/bin.
2055+ - Update usage of gettext to work around Python bug of gettext() not returning
2056+ unicodes, but str. Fixes UnicodeDecodeErrors on translated --help output.
2057+
2058+1.8.2 (2009-09-05)
2059+------------------
2060+Bug fixes.
2061+
2062+1.8.1 (2009-09-03)
2063+------------------
2064+Lots of bug fixes.
2065+
2066+1.8 (2009-08-26)
2067+----------------
2068+New features:
2069+ - Do not generally ignore SIGABRT any more. Try to extract the assertion
2070+ message from the core dump, and add it as "AssertionMessage" field. Mark
2071+ reports as unreportable if they do not have an assertion message and crashed
2072+ with SIGABRT. This requires your glibc to have this patch:
2073+ http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=48dcd0ba
2074+ - report.py, add_hooks_info(): Add optional package/srcpackage argument. Hooks
2075+ can use that to change the affected package or call hooks from different
2076+ packages.
2077+ - KDE frontend implementation of ui_question_userpass(), for crash databases
2078+ which need to ask for credentials.
2079+ - hookutils.py: New funtion attach_wifi() to add wireless network related
2080+ information to reports.
2081+
2082+Important bug fixes:
2083+ - Fix the test suite on current kernels; test/crash previously often failed
2084+ with python segfaults, since it killed the test processes too early.
2085+
2086+1.7 (2009-08-05):
2087+-----------------
2088+New features:
2089+ - Support for "symptom" scripts, which figure out the package for a bug report
2090+ based on interactive questions.
2091+
2092+1.6 (2009-07-15)
2093+----------------
2094+New features:
2095+ - Integrate analysis and retracing of kernel vmcore crashes with the "crash"
2096+ tool. Courtesy of Michael Vogt.
2097+
2098+Various little bug fixes.
2099+
2100+1.5 (2009-06-29)
2101+----------------
2102+New features:
2103+ - Drop all Makefiles, po/POTFILES.in, and most code from setup.py, and use
2104+ DistUtilsExtras.auto which "just does the right thing" for most build system
2105+ tasks. This requires python-distutils-extra >= 2.2, see
2106+ https://launchpad.net/python-distutils-extra
2107+
2108+Cleanup:
2109+ - Move all test scripts into test/, to unclutter source tree.
2110+ - setup.py now auto-detects the required packaging backend if
2111+ apport/packaging_impl.py is not manually installed.
2112+
2113+1.4 (2009-06-26)
2114+----------------
2115+New features:
2116+ - Replaced Qt4 frontend with a KDE frontend for better KDE integration.
2117+
2118+Major bug fixes:
2119+ - packaging-apt-dpkg.py: Add backwards compatibility code for python-apt <
2120+ 0.7.9 to not break backportability.
2121+
2122+1.3 (2009-06-10)
2123+----------------
2124+New features:
2125+- Interactive package hooks:
2126+ * Add apport.ui.HookUI class which provides GUI functionality such as yes/no
2127+ questions or file dialogs to hooks.
2128+ * add_info() in package hooks now can (optionally) take a second argument which
2129+ is the HookUI instance.
2130+ * See doc/package-hooks.txt for details.
2131+- New function apport.hookutils.root_command_output() to run a command as root,
2132+ through gksu/kdesudo/sudo, depending on the desktop environment.
2133+- Add general hook for analyzing reason of a segfault.
2134+
2135+Bug fixes:
2136+- Drop "UnsupportableReason" field, it is too similar to UnreportableReason and
2137+ just confusing.
2138+- Report key names can now contain dashes ('-') and underscores ('_').
2139+ (LP #380811)
2140+
2141+1.2.1 (2009-05-15)
2142+------------------
2143+Bug fixes:
2144+- Fix setup.py and PO file merging for recent .glade -> .ui renaming.
2145+
2146+Translations:
2147+- Update German translations.
2148+
2149+1.2.0 (2009-05-15)
2150+------------------
2151+Moving away from deprecated APIs:
2152+- packaging-apt-dpkg.py: Use python-apt >= 0.7.9 official API and drop usage of
2153+ internal symbols.
2154+- hookutils.py: Drop hal related functions and queries, replace with udev
2155+ database, udev log file, and DMI information from sysfs.
2156+- gtk UI: Convert from libglade to gtk.Builder.
2157+
2158+Bug fixes:
2159+- hookutils.py: Drop /proc/version_signature collection, it is Ubuntu specific.
2160+- apportcheckresume: Fix log collection from pm-utils.
2161+- Fix various crashes and report properties for reporting against uninstalled
2162+ packages.
2163+
2164+1.1.1 (2009-04-30)
2165+------------------
2166+Security fix:
2167+- etc/cron.daily/apport: Only attempt to remove files and symlinks, do not
2168+ descend into subdirectories of /var/crash/. Doing so might be exploited by a
2169+ race condition between find traversing a huge directory tree, changing an
2170+ existing subdir into a symlink to e. g. /etc/, and finally getting that piped
2171+ to rm. This also changes the find command to not use GNU extensions. Thanks
2172+ to Stephane Chazelas for discovering this! (LP #357024, CVE-2009-1295)
2173+
2174+Bug fixes:
2175+- launchpad.py: Send and read Date: field again, reverting r1128; it is useful
2176+ after all. (LP #349139)
2177+- Only add ProcAttrCurrent to reports if it is not "unconfined", to remove some
2178+ noise from reports.
2179+- Detect invalid PIDs in the UI (such as for kernel processes) and give a
2180+ friendly error message instead of silently doing nothing. (LP #360608)
2181+- Always run common hooks, and run source package hooks if we do not have a
2182+ binary package name. (LP #350131)
2183+- launchpad.py: Consider socket errors when connecting as transient, so
2184+ that crash-digger doesn't stop completely on them.
2185+
2186+1.1 (2009-04-20)
2187+----------------
2188+New features:
2189+- Add hookutils methods for attaching relevant packages, greatly improve
2190+ attach_alsa() for sound problem debugging.
2191+- Move launchpad crash database implementation from ever-breaking
2192+ python-launchpad-bugs (screenscraping) to launchpadlib (official and stable
2193+ Launchpad API).
2194+
2195+Bug fixes:
2196+- Drop some remaining distro specific pieces of code.
2197+- Add new field Report.pid which gets set on add_proc_info() and can be used by
2198+ hooks.
2199+- setup.py: Properly clean up all generated files, install missing
2200+ mimetypes/text-x-apport.svg icon symlink.
2201+- Add README file.
2202+- Add translations from Launchpad.
2203+- Remove preloadlib/*; it's undermaintained, and not really useful any more
2204+ these days.
2205+- Various bug fixes; most visible being the misnamed etc/default/apport.default
2206+ file (which should just be etc/default/apport).
2207+
2208+1.0 (2009-04-06)
2209+----------------
2210+First upstream release, based on Ubuntu packaging branch; that had been the
2211+de-facto trunk for many years, but this becomes unpractical with several
2212+distributions using it now.
2213
2214=== renamed file 'NEWS' => 'NEWS.moved'
2215=== added file 'README'
2216--- README 1970-01-01 00:00:00 +0000
2217+++ README 2013-03-13 18:57:21 +0000
2218@@ -0,0 +1,87 @@
2219+Apport crash detection/reporting
2220+================================
2221+
2222+Apport intercepts Program crashes, collects debugging information about the
2223+crash and the operating system environment, and sends it to bug trackers in a
2224+standardized form. It also offers the user to report a bug about a package,
2225+with again collecting as much information about it as possible.
2226+
2227+It currently supports
2228+
2229+ - Crashes from standard signals (SIGSEGV, SIGILL, etc.) through the kernel
2230+ coredump handler (in piping mode)
2231+ - Unhandled Python exceptions
2232+ - GTK, KDE, and command line user interfaces
2233+ - Packages can ship hooks for collecting specific data (such as
2234+ /var/log/Xorg.0.log for X.org, or modified gconf settings for GNOME
2235+ programs)
2236+ - apt/dpkg and rpm backend (in production use in Ubuntu and OpenSUSE)
2237+ - Reprocessing a core dump and debug symbols for post-mortem (and preferably
2238+ server-side) generation of fully symbolic stack traces (apport-retrace)
2239+ - Reporting bugs to Launchpad (more backends can be easily added)
2240+
2241+Please see https://wiki.ubuntu.com/Apport for more details and further links.
2242+The files in doc/ document particular details such as package hooks, crash
2243+database configuration, or the internal data format.
2244+
2245+Temporarily enabling apport
2246+===========================
2247+
2248+The automatic crash interception component of apport is disabled by default in
2249+stable releases for a number of reasons [1]. To enable it just for the current
2250+session, do
2251+
2252+ sudo service apport start force_start=1
2253+
2254+Then you can simply trigger the crash again, and Apport's dialog will show up
2255+with instructions to report a bug with traces. Apport will be automatically
2256+disabled on next start.
2257+
2258+If you are triaging bugs, this is the best way to get traces from bug reporters
2259+that didn't use Apport in the first place.
2260+
2261+To enable it permanently, do:
2262+
2263+ sudo nano /etc/default/apport
2264+
2265+and change enabled from "0" to "1".
2266+
2267+[1] https://wiki.ubuntu.com/Apport#How%20to%20enable%20apport
2268+
2269+Crash notification on servers
2270+=============================
2271+
2272+You can add
2273+
2274+if [ -x /usr/bin/apport-cli ]; then
2275+ if groups | grep -qw admin && /usr/share/apport/apport-checkreports -s; then
2276+ cat <<-EOF
2277+ You have new problem reports waiting in /var/crash.
2278+ To take a look at them, run "sudo apport-cli".
2279+
2280+ EOF
2281+ elif /usr/share/apport/apport-checkreports; then
2282+ cat <<-EOF
2283+ You have new problem reports waiting in /var/crash.
2284+ To take a look at them, run "apport-cli".
2285+
2286+ EOF
2287+ fi
2288+fi
2289+
2290+to your ~/.bashrc to get automatic notification of problem reports.
2291+
2292+Contributing
2293+============
2294+
2295+Please visit Apport's Launchpad homepage for links to the source code revision
2296+control, the bug tracker, translations, downloads, etc.:
2297+
2298+ https://launchpad.net/apport
2299+
2300+The preferred mode of operation for Linux distribution packagers is to create
2301+their own branch from 'trunk' and add the distro specific packaging and patches
2302+to it. Please send patches which are applicable to trunk as merge requests or
2303+bug reports, so that (1) other distributions can benefit from them as well, and
2304+(2) you reduce the code delta to upstream.
2305+
2306
2307=== renamed file 'README' => 'README.moved'
2308=== added file 'TODO'
2309--- TODO 1970-01-01 00:00:00 +0000
2310+++ TODO 2013-03-13 18:57:21 +0000
2311@@ -0,0 +1,21 @@
2312+apport:
2313+ - check crashes of root processes with dropped privs in test suite
2314+
2315+dup detection:
2316+ - add merging of two databases -> needs time stamp of last change
2317+
2318+GUI:
2319+ - point out bug privacy and to leave it private by default
2320+
2321+hooks:
2322+ - add hooks which run during program crash, to collect more runtime data
2323+
2324+hookutils:
2325+- run hooks for related packages in attach_related_packages
2326+
2327+apt-dpkg backend:
2328+- use python-apt's Version.get_source() instead of apt-get source
2329+
2330+apport-retrace:
2331+- add "gdb" mode: apport-gdb /usr/bin/myprog -> imply -S system, throw you into
2332+ gdb session with debug symbols
2333
2334=== renamed file 'TODO' => 'TODO.moved'
2335=== added directory 'apport'
2336=== renamed directory 'apport' => 'apport.moved'
2337=== added file 'apport/REThread.py'
2338--- apport/REThread.py 1970-01-01 00:00:00 +0000
2339+++ apport/REThread.py 2013-03-13 18:57:21 +0000
2340@@ -0,0 +1,65 @@
2341+'''Enhanced Thread with support for return values and exception propagation.'''
2342+
2343+# Copyright (C) 2007 Canonical Ltd.
2344+# Author: Martin Pitt <martin.pitt@ubuntu.com>
2345+#
2346+# This program is free software; you can redistribute it and/or modify it
2347+# under the terms of the GNU General Public License as published by the
2348+# Free Software Foundation; either version 2 of the License, or (at your
2349+# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
2350+# the full text of the license.
2351+
2352+import threading, sys
2353+
2354+
2355+class REThread(threading.Thread):
2356+ '''Thread with return values and exception propagation.'''
2357+
2358+ def __init__(self, group=None, target=None, name=None, args=(), kwargs={}):
2359+ '''Initialize Thread, identical to threading.Thread.__init__().'''
2360+
2361+ threading.Thread.__init__(self, group, target, name, args, kwargs)
2362+ self.__target = target
2363+ self.__args = args
2364+ self.__kwargs = kwargs
2365+ self._retval = None
2366+ self._exception = None
2367+
2368+ def run(self):
2369+ '''Run target function, identical to threading.Thread.run().'''
2370+
2371+ if self.__target:
2372+ try:
2373+ self._retval = self.__target(*self.__args, **self.__kwargs)
2374+ except:
2375+ if sys:
2376+ self._exception = sys.exc_info()
2377+
2378+ def return_value(self):
2379+ '''Return value from target function.
2380+
2381+ This can only be called after the thread has finished, i. e. when
2382+ isAlive() is False and did not terminate with an exception.
2383+ '''
2384+ assert not self.isAlive()
2385+ assert not self._exception
2386+ return self._retval
2387+
2388+ def exc_info(self):
2389+ '''Return (type, value, traceback) of the exception caught in run().'''
2390+
2391+ return self._exception
2392+
2393+ def exc_raise(self):
2394+ '''Raise the exception caught in the thread.
2395+
2396+ Do nothing if no exception was caught.
2397+ '''
2398+ if self._exception:
2399+ # there is no syntax which both Python 2 and 3 parse, so we need a
2400+ # hack using exec() here
2401+ # Python 3:
2402+ if sys.version > '3':
2403+ raise self._exception[1].with_traceback(self._exception[2])
2404+ else:
2405+ exec('raise self._exception[0], self._exception[1], self._exception[2]')
2406
2407=== added file 'apport/__init__.py'
2408--- apport/__init__.py 1970-01-01 00:00:00 +0000
2409+++ apport/__init__.py 2013-03-13 18:57:21 +0000
2410@@ -0,0 +1,73 @@
2411+import sys
2412+import os
2413+import time
2414+
2415+from apport.report import Report
2416+
2417+from apport.packaging_impl import impl as packaging
2418+
2419+Report # pyflakes
2420+packaging # pyflakes
2421+
2422+# fix gettext to output proper unicode strings
2423+import gettext
2424+
2425+
2426+def unicode_gettext(str):
2427+ trans = gettext.gettext(str)
2428+ if type(trans) == type(b''):
2429+ return trans.decode('UTF-8')
2430+ else:
2431+ return trans
2432+
2433+
2434+def log(message, timestamp=False):
2435+ '''Log the given string to stdout. Prepend timestamp if requested'''
2436+
2437+ if timestamp:
2438+ sys.stdout.write('%s: ' % time.strftime('%x %X'))
2439+ print(message)
2440+
2441+
2442+def fatal(msg, *args):
2443+ '''Print out an error message and exit the program.'''
2444+
2445+ error(msg, *args)
2446+ sys.exit(1)
2447+
2448+
2449+def error(msg, *args):
2450+ '''Print out an error message.'''
2451+
2452+ if sys.stderr:
2453+ sys.stderr.write('ERROR: ')
2454+ sys.stderr.write(msg % args)
2455+ sys.stderr.write('\n')
2456+
2457+
2458+def warning(msg, *args):
2459+ '''Print out an warning message.'''
2460+
2461+ if sys.stderr:
2462+ sys.stderr.write('WARNING: ')
2463+ sys.stderr.write(msg % args)
2464+ sys.stderr.write('\n')
2465+
2466+
2467+def memdbg(checkpoint):
2468+ '''Print current memory usage.
2469+
2470+ This is only done if $APPORT_MEMDEBUG is set.
2471+ '''
2472+ if not 'APPORT_MEMDEBUG' in os.environ or not sys.stderr:
2473+ return
2474+
2475+ memstat = {}
2476+ with open('/proc/self/status') as f:
2477+ for l in f:
2478+ if l.startswith('Vm'):
2479+ (field, size, unit) = l.split()
2480+ memstat[field[:-1]] = int(size) / 1024.
2481+
2482+ sys.stderr.write('Size: %.1f MB, RSS: %.1f MB, Stk: %.1f MB @ %s\n' %
2483+ (memstat['VmSize'], memstat['VmRSS'], memstat['VmStk'], checkpoint))
2484
2485=== added file 'apport/com.ubuntu.apport.policy.in'
2486--- apport/com.ubuntu.apport.policy.in 1970-01-01 00:00:00 +0000
2487+++ apport/com.ubuntu.apport.policy.in 2013-03-13 18:57:21 +0000
2488@@ -0,0 +1,34 @@
2489+<?xml version="1.0" encoding="UTF-8"?>
2490+<!DOCTYPE policyconfig PUBLIC
2491+ "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
2492+ "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd">
2493+<policyconfig>
2494+ <vendor>Apport</vendor>
2495+ <vendor_url>https://wiki.ubuntu.com/Apport</vendor_url>
2496+ <icon_name>apport</icon_name>
2497+
2498+ <action id="com.ubuntu.apport.root-info">
2499+ <_description>Collect system information</_description>
2500+ <_message>Authentication is required to collect system information for this problem report</_message>
2501+ <annotate key="org.freedesktop.policykit.exec.path">/usr/share/apport/root_info_wrapper</annotate>
2502+ <!-- <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate> -->
2503+ <defaults>
2504+ <allow_any>auth_admin</allow_any>
2505+ <allow_inactive>auth_admin</allow_inactive>
2506+ <allow_active>auth_admin</allow_active>
2507+ </defaults>
2508+ </action>
2509+
2510+ <action id="com.ubuntu.apport.apport-gtk-root">
2511+ <_description>System problem reports</_description>
2512+ <_message>Please enter your password to access problem reports of system programs</_message>
2513+ <annotate key="org.freedesktop.policykit.exec.path">/usr/share/apport/apport-gtk</annotate>
2514+ <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
2515+ <defaults>
2516+ <allow_any>auth_admin</allow_any>
2517+ <allow_inactive>auth_admin</allow_inactive>
2518+ <allow_active>auth_admin</allow_active>
2519+ </defaults>
2520+ </action>
2521+
2522+</policyconfig>
2523
2524=== added file 'apport/crashdb.py'
2525--- apport/crashdb.py 1970-01-01 00:00:00 +0000
2526+++ apport/crashdb.py 2013-03-13 18:57:21 +0000
2527@@ -0,0 +1,856 @@
2528+'''Abstract crash database interface.'''
2529+
2530+# Copyright (C) 2007 - 2009 Canonical Ltd.
2531+# Author: Martin Pitt <martin.pitt@ubuntu.com>
2532+#
2533+# This program is free software; you can redistribute it and/or modify it
2534+# under the terms of the GNU General Public License as published by the
2535+# Free Software Foundation; either version 2 of the License, or (at your
2536+# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
2537+# the full text of the license.
2538+
2539+import os, os.path, sys, shutil
2540+
2541+try:
2542+ from exceptions import Exception
2543+ from urllib import quote_plus, urlopen
2544+ URLError = IOError
2545+ (quote_plus, urlopen) # pyflakes
2546+except ImportError:
2547+ # python 3
2548+ from functools import cmp_to_key
2549+ from urllib.parse import quote_plus
2550+ from urllib.request import urlopen
2551+ from urllib.error import URLError
2552+
2553+import apport
2554+
2555+
2556+def _u(str):
2557+ '''Convert str to an unicode if it isn't already.'''
2558+
2559+ if type(str) == type(b''):
2560+ return str.decode('UTF-8', 'ignore')
2561+ return str
2562+
2563+
2564+class CrashDatabase:
2565+ def __init__(self, auth_file, options):
2566+ '''Initialize crash database connection.
2567+
2568+ You need to specify an implementation specific file with the
2569+ authentication credentials for retracing access for download() and
2570+ update(). For upload() and get_comment_url() you can use None.
2571+
2572+ options is a dictionary with additional settings from crashdb.conf; see
2573+ get_crashdb() for details.
2574+ '''
2575+ self.auth_file = auth_file
2576+ self.options = options
2577+ self.duplicate_db = None
2578+
2579+ def get_bugpattern_baseurl(self):
2580+ '''Return the base URL for bug patterns.
2581+
2582+ See apport.report.Report.search_bug_patterns() for details. If this
2583+ function returns None, bug patterns are disabled.
2584+ '''
2585+ return self.options.get('bug_pattern_url')
2586+
2587+ def accepts(self, report):
2588+ '''Check if this report can be uploaded to this database.
2589+
2590+ Crash databases might limit the types of reports they get with e. g.
2591+ the "problem_types" option.
2592+ '''
2593+ if 'problem_types' in self.options:
2594+ return report.get('ProblemType') in self.options['problem_types']
2595+
2596+ return True
2597+
2598+ #
2599+ # API for duplicate detection
2600+ #
2601+ # Tests are in apport/crashdb_impl/memory.py.
2602+
2603+ def init_duplicate_db(self, path):
2604+ '''Initialize duplicate database.
2605+
2606+ path specifies an SQLite database. It will be created if it does not
2607+ exist yet.
2608+ '''
2609+ import sqlite3 as dbapi2
2610+
2611+ assert dbapi2.paramstyle == 'qmark', \
2612+ 'this module assumes qmark dbapi parameter style'
2613+
2614+ self.format_version = 3
2615+
2616+ init = not os.path.exists(path) or path == ':memory:' or \
2617+ os.path.getsize(path) == 0
2618+ self.duplicate_db = dbapi2.connect(path, timeout=7200)
2619+
2620+ if init:
2621+ cur = self.duplicate_db.cursor()
2622+ cur.execute('CREATE TABLE version (format INTEGER NOT NULL)')
2623+ cur.execute('INSERT INTO version VALUES (?)', [self.format_version])
2624+
2625+ cur.execute('''CREATE TABLE crashes (
2626+ signature VARCHAR(255) NOT NULL,
2627+ crash_id INTEGER NOT NULL,
2628+ fixed_version VARCHAR(50),
2629+ last_change TIMESTAMP,
2630+ CONSTRAINT crashes_pk PRIMARY KEY (crash_id))''')
2631+
2632+ cur.execute('''CREATE TABLE address_signatures (
2633+ signature VARCHAR(1000) NOT NULL,
2634+ crash_id INTEGER NOT NULL,
2635+ CONSTRAINT address_signatures_pk PRIMARY KEY (signature))''')
2636+
2637+ self.duplicate_db.commit()
2638+
2639+ # verify integrity
2640+ cur = self.duplicate_db.cursor()
2641+ cur.execute('PRAGMA integrity_check')
2642+ result = cur.fetchall()
2643+ if result != [('ok',)]:
2644+ raise SystemError('Corrupt duplicate db:' + str(result))
2645+
2646+ try:
2647+ cur.execute('SELECT format FROM version')
2648+ result = cur.fetchone()
2649+ except self.duplicate_db.OperationalError as e:
2650+ if 'no such table' in str(e):
2651+ # first db format did not have version table yet
2652+ result = [0]
2653+ if result[0] > self.format_version:
2654+ raise SystemError('duplicate DB has unknown format %i' % result[0])
2655+ if result[0] < self.format_version:
2656+ print('duplicate db has format %i, upgrading to %i' %
2657+ (result[0], self.format_version))
2658+ self._duplicate_db_upgrade(result[0])
2659+
2660+ def check_duplicate(self, id, report=None):
2661+ '''Check whether a crash is already known.
2662+
2663+ If the crash is new, it will be added to the duplicate database and the
2664+ function returns None. If the crash is already known, the function
2665+ returns a pair (crash_id, fixed_version), where fixed_version might be
2666+ None if the crash is not fixed in the latest version yet. Depending on
2667+ whether the version in report is smaller than/equal to the fixed
2668+ version or larger, this calls close_duplicate() or mark_regression().
2669+
2670+ If the report does not have a valid crash signature, this function does
2671+ nothing and just returns None.
2672+
2673+ By default, the report gets download()ed, but for performance reasons
2674+ it can be explicitly passed to this function if it is already available.
2675+ '''
2676+ assert self.duplicate_db, 'init_duplicate_db() needs to be called before'
2677+
2678+ if not report:
2679+ report = self.download(id)
2680+
2681+ self._mark_dup_checked(id, report)
2682+
2683+ if 'DuplicateSignature' in report:
2684+ sig = report['DuplicateSignature']
2685+ else:
2686+ sig = report.crash_signature()
2687+ existing = []
2688+ if sig:
2689+ # use real duplicate signature
2690+ existing = self._duplicate_search_signature(sig, id)
2691+
2692+ if existing:
2693+ # update status of existing master bugs
2694+ for (ex_id, _) in existing:
2695+ self._duplicate_db_sync_status(ex_id)
2696+ existing = self._duplicate_search_signature(sig, id)
2697+
2698+ try:
2699+ report_package_version = report['Package'].split()[1]
2700+ except (KeyError, IndexError):
2701+ report_package_version = None
2702+
2703+ # check the existing IDs whether there is one that is unfixed or not
2704+ # older than the report's package version; if so, we have a duplicate.
2705+ master_id = None
2706+ master_ver = None
2707+ for (ex_id, ex_ver) in existing:
2708+ if not ex_ver or not report_package_version or apport.packaging.compare_versions(report_package_version, ex_ver) < 0:
2709+ master_id = ex_id
2710+ master_ver = ex_ver
2711+ break
2712+ else:
2713+ # if we did not find a new enough open master report,
2714+ # we have a regression of the latest fix. Mark it so, and create a
2715+ # new unfixed ID for it later on
2716+ if existing:
2717+ self.mark_regression(id, existing[-1][0])
2718+
2719+ # now query address signatures, they might turn up another duplicate
2720+ # (not necessarily the same, due to Stacktraces sometimes being
2721+ # slightly different)
2722+ addr_sig = report.crash_signature_addresses()
2723+ if addr_sig:
2724+ addr_match = self._duplicate_search_address_signature(addr_sig)
2725+ if addr_match and addr_match != master_id:
2726+ if master_id is None:
2727+ # we have a duplicate only identified by address sig, close it
2728+ master_id = addr_match
2729+ else:
2730+ # our bug is a dupe of two different masters, one from
2731+ # symbolic, the other from addr matching (see LP#943117);
2732+ # make them all duplicates of each other, using the lower
2733+ # number as master
2734+ if master_id < addr_match:
2735+ self.close_duplicate(report, addr_match, master_id)
2736+ self._duplicate_db_merge_id(addr_match, master_id)
2737+ else:
2738+ self.close_duplicate(report, master_id, addr_match)
2739+ self._duplicate_db_merge_id(master_id, addr_match)
2740+ master_id = addr_match
2741+ master_ver = None # no version tracking for address signatures yet
2742+
2743+ if master_id is not None and master_id != id:
2744+ if addr_sig:
2745+ self._duplicate_db_add_address_signature(addr_sig, master_id)
2746+ self.close_duplicate(report, id, master_id)
2747+ return (master_id, master_ver)
2748+
2749+ # no duplicate detected; create a new record for the ID if we don't have one already
2750+ if sig:
2751+ cur = self.duplicate_db.cursor()
2752+ cur.execute('SELECT count(*) FROM crashes WHERE crash_id == ?', [id])
2753+ count_id = cur.fetchone()[0]
2754+ if count_id == 0:
2755+ cur.execute('INSERT INTO crashes VALUES (?, ?, ?, CURRENT_TIMESTAMP)', (_u(sig), id, None))
2756+ self.duplicate_db.commit()
2757+ if addr_sig:
2758+ self._duplicate_db_add_address_signature(addr_sig, id)
2759+
2760+ return None
2761+
2762+ def known(self, report):
2763+ '''Check if the crash db already knows about the crash signature.
2764+
2765+ Check if the report has a DuplicateSignature, crash_signature(), or
2766+ StacktraceAddressSignature, and ask the database whether the problem is
2767+ already known. If so, return an URL where the user can check the status
2768+ or subscribe (if available), or just return True if the report is known
2769+ but there is no public URL. In that case the report will not be
2770+ uploaded (i. e. upload() will not be called).
2771+
2772+ Return None if the report does not have any signature or the crash
2773+ database does not support checking for duplicates on the client side.
2774+
2775+ The default implementation uses a text file format generated by
2776+ duplicate_db_publish() at an URL specified by the "dupdb_url" option.
2777+ Subclasses are free to override this with a custom implementation, such
2778+ as a real database lookup.
2779+ '''
2780+ if not self.options.get('dupdb_url'):
2781+ return None
2782+
2783+ for kind in ('sig', 'address'):
2784+ # get signature
2785+ if kind == 'sig':
2786+ if 'DuplicateSignature' in report:
2787+ sig = report['DuplicateSignature']
2788+ else:
2789+ sig = report.crash_signature()
2790+ else:
2791+ sig = report.crash_signature_addresses()
2792+
2793+ if not sig:
2794+ continue
2795+
2796+ # build URL where the data should be
2797+ h = self.duplicate_sig_hash(sig)
2798+ if not h:
2799+ return None
2800+
2801+ # the hash is already quoted, but we really want to open the quoted
2802+ # file names; as urlopen() unquotes, we need to double-quote here
2803+ # again so that urlopen() sees the single-quoted file names
2804+ url = os.path.join(self.options['dupdb_url'], kind, quote_plus(h))
2805+
2806+ # read data file
2807+ try:
2808+ f = urlopen(url)
2809+ contents = f.read().decode('UTF-8')
2810+ f.close()
2811+ if '<title>404 Not Found' in contents:
2812+ continue
2813+ except (IOError, URLError):
2814+ # does not exist, failed to load, etc.
2815+ continue
2816+
2817+ # now check if we find our signature
2818+ for line in contents.splitlines():
2819+ try:
2820+ id, s = line.split(None, 1)
2821+ id = int(id)
2822+ except ValueError:
2823+ continue
2824+ if s == sig:
2825+ result = self.get_id_url(report, id)
2826+ if not result:
2827+ # if we can't have an URL, just report as "known"
2828+ result = '1'
2829+ return result
2830+
2831+ return None
2832+
2833+ def duplicate_db_fixed(self, id, version):
2834+ '''Mark given crash ID as fixed in the duplicate database.
2835+
2836+ version specifies the package version the crash was fixed in (None for
2837+ 'still unfixed').
2838+ '''
2839+ assert self.duplicate_db, 'init_duplicate_db() needs to be called before'
2840+
2841+ cur = self.duplicate_db.cursor()
2842+ n = cur.execute('UPDATE crashes SET fixed_version = ?, last_change = CURRENT_TIMESTAMP WHERE crash_id = ?',
2843+ (version, id))
2844+ assert n.rowcount == 1
2845+ self.duplicate_db.commit()
2846+
2847+ def duplicate_db_remove(self, id):
2848+ '''Remove crash from the duplicate database.
2849+
2850+ This happens when a report got rejected or manually duplicated.
2851+ '''
2852+ assert self.duplicate_db, 'init_duplicate_db() needs to be called before'
2853+
2854+ cur = self.duplicate_db.cursor()
2855+ cur.execute('DELETE FROM crashes WHERE crash_id = ?', [id])
2856+ cur.execute('DELETE FROM address_signatures WHERE crash_id = ?', [id])
2857+ self.duplicate_db.commit()
2858+
2859+ def duplicate_db_change_master_id(self, old_id, new_id):
2860+ '''Change a crash ID.'''
2861+
2862+ assert self.duplicate_db, 'init_duplicate_db() needs to be called before'
2863+
2864+ cur = self.duplicate_db.cursor()
2865+ cur.execute('UPDATE crashes SET crash_id = ?, last_change = CURRENT_TIMESTAMP WHERE crash_id = ?',
2866+ [new_id, old_id])
2867+ cur.execute('UPDATE address_signatures SET crash_id = ? WHERE crash_id = ?',
2868+ [new_id, old_id])
2869+ self.duplicate_db.commit()
2870+
2871+ def duplicate_db_publish(self, dir):
2872+ '''Create text files suitable for www publishing.
2873+
2874+ Create a number of text files in the given directory which Apport
2875+ clients can use to determine whether a problem is already reported to
2876+ the database, through the known() method. This directory is suitable
2877+ for publishing to the web.
2878+
2879+ The database is indexed by the first two fields of the duplicate or
2880+ crash signature, to avoid having to download the entire database every
2881+ time.
2882+
2883+ If the directory already exists, it will be updated. The new content is
2884+ built in a new directory which is the given one with ".new" appended,
2885+ then moved to the given name in an almost atomic way.
2886+ '''
2887+ assert self.duplicate_db, 'init_duplicate_db() needs to be called before'
2888+
2889+ # first create the temporary new dir; if that fails, nothing has been
2890+ # changed and we fail early
2891+ out = dir + '.new'
2892+ os.mkdir(out)
2893+
2894+ # crash addresses
2895+ addr_base = os.path.join(out, 'address')
2896+ os.mkdir(addr_base)
2897+ cur_hash = None
2898+ cur_file = None
2899+
2900+ cur = self.duplicate_db.cursor()
2901+
2902+ cur.execute('SELECT * from address_signatures ORDER BY signature')
2903+ for (sig, id) in cur.fetchall():
2904+ h = self.duplicate_sig_hash(sig)
2905+ if h is None:
2906+ # some entries can't be represented in a single line
2907+ continue
2908+ if h != cur_hash:
2909+ cur_hash = h
2910+ if cur_file:
2911+ cur_file.close()
2912+ cur_file = open(os.path.join(addr_base, cur_hash), 'w')
2913+
2914+ cur_file.write('%i %s\n' % (id, sig))
2915+
2916+ if cur_file:
2917+ cur_file.close()
2918+
2919+ # duplicate signatures
2920+ sig_base = os.path.join(out, 'sig')
2921+ os.mkdir(sig_base)
2922+ cur_hash = None
2923+ cur_file = None
2924+
2925+ cur.execute('SELECT signature, crash_id from crashes ORDER BY signature')
2926+ for (sig, id) in cur.fetchall():
2927+ h = self.duplicate_sig_hash(sig)
2928+ if h is None:
2929+ # some entries can't be represented in a single line
2930+ continue
2931+ if h != cur_hash:
2932+ cur_hash = h
2933+ if cur_file:
2934+ cur_file.close()
2935+ cur_file = open(os.path.join(sig_base, cur_hash), 'wb')
2936+
2937+ cur_file.write(('%i %s\n' % (id, sig)).encode('UTF-8'))
2938+
2939+ if cur_file:
2940+ cur_file.close()
2941+
2942+ # switch over tree; this is as atomic as we can be with directories
2943+ if os.path.exists(dir):
2944+ os.rename(dir, dir + '.old')
2945+ os.rename(out, dir)
2946+ if os.path.exists(dir + '.old'):
2947+ shutil.rmtree(dir + '.old')
2948+
2949+ def _duplicate_db_upgrade(self, cur_format):
2950+ '''Upgrade database to current format'''
2951+
2952+ # Format 3 added a primary key which can't be done as an upgrade in
2953+ # SQLite
2954+ if cur_format < 3:
2955+ raise SystemError('Cannot upgrade database from format earlier than 3')
2956+
2957+ cur = self.duplicate_db.cursor()
2958+
2959+ cur.execute('UPDATE version SET format = ?', (cur_format,))
2960+ self.duplicate_db.commit()
2961+
2962+ assert cur_format == self.format_version
2963+
2964+ def _duplicate_search_signature(self, sig, id):
2965+ '''Look up signature in the duplicate db.
2966+
2967+ Return [(id, fixed_version)] tuple list.
2968+
2969+ There might be several matches if a crash has been reintroduced in a
2970+ later version. The results are sorted so that the highest fixed version
2971+ comes first, and "unfixed" being the last result.
2972+
2973+ id is the bug we are looking to find a duplicate for. The result will
2974+ never contain id, to avoid marking a bug as a duplicate of itself if a
2975+ bug is reprocessed more than once.
2976+ '''
2977+ cur = self.duplicate_db.cursor()
2978+ cur.execute('SELECT crash_id, fixed_version FROM crashes WHERE signature = ? AND crash_id <> ?', [_u(sig), id])
2979+ existing = cur.fetchall()
2980+
2981+ def cmp(x, y):
2982+ x = x[1]
2983+ y = y[1]
2984+ if x == y:
2985+ return 0
2986+ if x == '':
2987+ if y is None:
2988+ return -1
2989+ else:
2990+ return 1
2991+ if y == '':
2992+ if x is None:
2993+ return 1
2994+ else:
2995+ return -1
2996+ if x is None:
2997+ return 1
2998+ if y is None:
2999+ return -1
3000+ return apport.packaging.compare_versions(x, y)
3001+
3002+ if sys.version[0] >= '3':
3003+ existing.sort(key=cmp_to_key(cmp))
3004+ else:
3005+ existing.sort(cmp=cmp)
3006+
3007+ return existing
3008+
3009+ def _duplicate_search_address_signature(self, sig):
3010+ '''Return ID for crash address signature.
3011+
3012+ Return None if signature is unknown.
3013+ '''
3014+ if not sig:
3015+ return None
3016+
3017+ cur = self.duplicate_db.cursor()
3018+
3019+ cur.execute('SELECT crash_id FROM address_signatures WHERE signature == ?', [sig])
3020+ existing_ids = cur.fetchall()
3021+ assert len(existing_ids) <= 1
3022+ if existing_ids:
3023+ return existing_ids[0][0]
3024+ else:
3025+ return None
3026+
3027+ def _duplicate_db_dump(self, with_timestamps=False):
3028+ '''Return the entire duplicate database as a dictionary.
3029+
3030+ The returned dictionary maps "signature" to (crash_id, fixed_version)
3031+ pairs.
3032+
3033+ If with_timestamps is True, then the map will contain triples
3034+ (crash_id, fixed_version, last_change) instead.
3035+
3036+ This is mainly useful for debugging and test suites.
3037+ '''
3038+ assert self.duplicate_db, 'init_duplicate_db() needs to be called before'
3039+
3040+ dump = {}
3041+ cur = self.duplicate_db.cursor()
3042+ cur.execute('SELECT * FROM crashes')
3043+ for (sig, id, ver, last_change) in cur:
3044+ if with_timestamps:
3045+ dump[sig] = (id, ver, last_change)
3046+ else:
3047+ dump[sig] = (id, ver)
3048+ return dump
3049+
3050+ def _duplicate_db_sync_status(self, id):
3051+ '''Update the duplicate db to the reality of the report in the crash db.
3052+
3053+ This uses get_fixed_version() to get the status of the given crash.
3054+ An invalid ID gets removed from the duplicate db, and a crash which got
3055+ fixed is marked as such in the database.
3056+ '''
3057+ assert self.duplicate_db, 'init_duplicate_db() needs to be called before'
3058+
3059+ cur = self.duplicate_db.cursor()
3060+ cur.execute('SELECT fixed_version FROM crashes WHERE crash_id = ?', [id])
3061+ db_fixed_version = cur.fetchone()
3062+ if not db_fixed_version:
3063+ return
3064+ db_fixed_version = db_fixed_version[0]
3065+
3066+ real_fixed_version = self.get_fixed_version(id)
3067+
3068+ # crash got rejected
3069+ if real_fixed_version == 'invalid':
3070+ print('DEBUG: bug %i was invalidated, removing from database' % id)
3071+ self.duplicate_db_remove(id)
3072+ return
3073+
3074+ # crash got fixed
3075+ if not db_fixed_version and real_fixed_version:
3076+ print('DEBUG: bug %i got fixed in version %s, updating database' % (id, real_fixed_version))
3077+ self.duplicate_db_fixed(id, real_fixed_version)
3078+ return
3079+
3080+ # crash got reopened
3081+ if db_fixed_version and not real_fixed_version:
3082+ print('DEBUG: bug %i got reopened, dropping fixed version %s from database' % (id, db_fixed_version))
3083+ self.duplicate_db_fixed(id, real_fixed_version)
3084+ return
3085+
3086+ def _duplicate_db_add_address_signature(self, sig, id):
3087+ # sanity check
3088+ existing = self._duplicate_search_address_signature(sig)
3089+ if existing:
3090+ if existing != id:
3091+ raise SystemError('ID %i has signature %s, but database already has that signature for ID %i' % (
3092+ id, sig, existing))
3093+ else:
3094+ cur = self.duplicate_db.cursor()
3095+ cur.execute('INSERT INTO address_signatures VALUES (?, ?)', (_u(sig), id))
3096+ self.duplicate_db.commit()
3097+
3098+ def _duplicate_db_merge_id(self, dup, master):
3099+ '''Merge two crash IDs.
3100+
3101+ This is necessary when having to mark a bug as a duplicate if it
3102+ already is in the duplicate DB.
3103+ '''
3104+ assert self.duplicate_db, 'init_duplicate_db() needs to be called before'
3105+
3106+ cur = self.duplicate_db.cursor()
3107+ cur.execute('DELETE FROM crashes WHERE crash_id = ?', [dup])
3108+ cur.execute('UPDATE address_signatures SET crash_id = ? WHERE crash_id = ?',
3109+ [master, dup])
3110+ self.duplicate_db.commit()
3111+
3112+ @classmethod
3113+ def duplicate_sig_hash(klass, sig):
3114+ '''Create a www/URL proof hash for a duplicate signature'''
3115+
3116+ # cannot hash multi-line custom duplicate signatures
3117+ if '\n' in sig:
3118+ return None
3119+
3120+ # custom DuplicateSignatures have a free format, split off first word
3121+ i = sig.split(' ', 1)[0]
3122+ # standard crash/address signatures use ':' as field separator, usually
3123+ # for ExecutableName:Signal
3124+ i = '_'.join(i.split(':', 2)[:2])
3125+ # we manually quote '/' to make them nicer to read
3126+ i = i.replace('/', '_')
3127+ i = quote_plus(i.encode('UTF-8'))
3128+ # avoid too long file names
3129+ i = i[:200]
3130+ return i
3131+
3132+ #
3133+ # Abstract functions that need to be implemented by subclasses
3134+ #
3135+
3136+ def upload(self, report, progress_callback=None):
3137+ '''Upload given problem report return a handle for it.
3138+
3139+ This should happen noninteractively.
3140+
3141+ If the implementation supports it, and a function progress_callback is
3142+ passed, that is called repeatedly with two arguments: the number of
3143+ bytes already sent, and the total number of bytes to send. This can be
3144+ used to provide a proper upload progress indication on frontends.
3145+
3146+ Implementations ought to "assert self.accepts(report)". The UI logic
3147+ already prevents uploading a report to a database which does not accept
3148+ it, but for third-party users of the API this should still be checked.
3149+
3150+ This method can raise a NeedsCredentials exception in case of failure.
3151+ '''
3152+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3153+
3154+ def get_comment_url(self, report, handle):
3155+ '''Return an URL that should be opened after report has been uploaded
3156+ and upload() returned handle.
3157+
3158+ Should return None if no URL should be opened (anonymous filing without
3159+ user comments); in that case this function should do whichever
3160+ interactive steps it wants to perform.
3161+ '''
3162+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3163+
3164+ def get_id_url(self, report, id):
3165+ '''Return URL for a given report ID.
3166+
3167+ The report is passed in case building the URL needs additional
3168+ information from it, such as the SourcePackage name.
3169+
3170+ Return None if URL is not available or cannot be determined.
3171+ '''
3172+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3173+
3174+ def download(self, id):
3175+ '''Download the problem report from given ID and return a Report.'''
3176+
3177+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3178+
3179+ def update(self, id, report, comment, change_description=False,
3180+ attachment_comment=None, key_filter=None):
3181+ '''Update the given report ID with all data from report.
3182+
3183+ This creates a text comment with the "short" data (see
3184+ ProblemReport.write_mime()), and creates attachments for all the
3185+ bulk/binary data.
3186+
3187+ If change_description is True, and the crash db implementation supports
3188+ it, the short data will be put into the description instead (like in a
3189+ new bug).
3190+
3191+ comment will be added to the "short" data. If attachment_comment is
3192+ given, it will be added to the attachment uploads.
3193+
3194+ If key_filter is a list or set, then only those keys will be added.
3195+ '''
3196+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3197+
3198+ def update_traces(self, id, report, comment=''):
3199+ '''Update the given report ID for retracing results.
3200+
3201+ This updates Stacktrace, ThreadStacktrace, StacktraceTop,
3202+ and StacktraceSource. You can also supply an additional comment.
3203+ '''
3204+ self.update(id, report, comment, key_filter=[
3205+ 'Stacktrace', 'ThreadStacktrace', 'StacktraceSource', 'StacktraceTop'])
3206+
3207+ def set_credentials(self, username, password):
3208+ '''Set username and password.'''
3209+
3210+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3211+
3212+ def get_distro_release(self, id):
3213+ '''Get 'DistroRelease: <release>' from the report ID.'''
3214+
3215+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3216+
3217+ def get_unretraced(self):
3218+ '''Return set of crash IDs which have not been retraced yet.
3219+
3220+ This should only include crashes which match the current host
3221+ architecture.
3222+ '''
3223+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3224+
3225+ def get_dup_unchecked(self):
3226+ '''Return set of crash IDs which need duplicate checking.
3227+
3228+ This is mainly useful for crashes of scripting languages such as
3229+ Python, since they do not need to be retraced. It should not return
3230+ bugs that are covered by get_unretraced().
3231+ '''
3232+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3233+
3234+ def get_unfixed(self):
3235+ '''Return an ID set of all crashes which are not yet fixed.
3236+
3237+ The list must not contain bugs which were rejected or duplicate.
3238+
3239+ This function should make sure that the returned list is correct. If
3240+ there are any errors with connecting to the crash database, it should
3241+ raise an exception (preferably IOError).
3242+ '''
3243+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3244+
3245+ def get_fixed_version(self, id):
3246+ '''Return the package version that fixes a given crash.
3247+
3248+ Return None if the crash is not yet fixed, or an empty string if the
3249+ crash is fixed, but it cannot be determined by which version. Return
3250+ 'invalid' if the crash report got invalidated, such as closed a
3251+ duplicate or rejected.
3252+
3253+ This function should make sure that the returned result is correct. If
3254+ there are any errors with connecting to the crash database, it should
3255+ raise an exception (preferably IOError).
3256+ '''
3257+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3258+
3259+ def get_affected_packages(self, id):
3260+ '''Return list of affected source packages for given ID.'''
3261+
3262+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3263+
3264+ def is_reporter(self, id):
3265+ '''Check whether the user is the reporter of given ID.'''
3266+
3267+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3268+
3269+ def can_update(self, id):
3270+ '''Check whether the user is eligible to update a report.
3271+
3272+ A user should add additional information to an existing ID if (s)he is
3273+ the reporter or subscribed, the bug is open, not a duplicate, etc. The
3274+ exact policy and checks should be done according to the particular
3275+ implementation.
3276+ '''
3277+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3278+
3279+ def duplicate_of(self, id):
3280+ '''Return master ID for a duplicate bug.
3281+
3282+ If the bug is not a duplicate, return None.
3283+ '''
3284+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3285+
3286+ def close_duplicate(self, report, id, master):
3287+ '''Mark a crash id as duplicate of given master ID.
3288+
3289+ If master is None, id gets un-duplicated.
3290+ '''
3291+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3292+
3293+ def mark_regression(self, id, master):
3294+ '''Mark a crash id as reintroducing an earlier crash which is
3295+ already marked as fixed (having ID 'master').'''
3296+
3297+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3298+
3299+ def mark_retraced(self, id):
3300+ '''Mark crash id as retraced.'''
3301+
3302+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3303+
3304+ def mark_retrace_failed(self, id, invalid_msg=None):
3305+ '''Mark crash id as 'failed to retrace'.
3306+
3307+ If invalid_msg is given, the bug should be closed as invalid with given
3308+ message, otherwise just marked as a failed retrace.
3309+
3310+ This can be a no-op if you are not interested in this.
3311+ '''
3312+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3313+
3314+ def _mark_dup_checked(self, id, report):
3315+ '''Mark crash id as checked for being a duplicate
3316+
3317+ This is an internal method that should not be called from outside.
3318+ '''
3319+ raise NotImplementedError('this method must be implemented by a concrete subclass')
3320+
3321+#
3322+# factory
3323+#
3324+
3325+
3326+def get_crashdb(auth_file, name=None, conf=None):
3327+ '''Return a CrashDatabase object for the given crash db name.
3328+
3329+ This reads the configuration file 'conf'.
3330+
3331+ If name is None, it defaults to the 'default' value in conf.
3332+
3333+ If conf is None, it defaults to the environment variable
3334+ APPORT_CRASHDB_CONF; if that does not exist, the hardcoded default is
3335+ /etc/apport/crashdb.conf. This Python syntax file needs to specify:
3336+
3337+ - A string variable 'default', giving a default value for 'name' if that is
3338+ None.
3339+
3340+ - A dictionary 'databases' which maps names to crash db configuration
3341+ dictionaries. These need to have at least the key 'impl' (Python module
3342+ in apport.crashdb_impl which contains a concrete 'CrashDatabase' class
3343+ implementation for that crash db type). Other generally known options are
3344+ 'bug_pattern_url', 'dupdb_url', and 'problem_types'.
3345+ '''
3346+ if not conf:
3347+ conf = os.environ.get('APPORT_CRASHDB_CONF', '/etc/apport/crashdb.conf')
3348+ settings = {}
3349+ with open(conf) as f:
3350+ exec(compile(f.read(), conf, 'exec'), settings)
3351+
3352+ # Load third parties crashdb.conf
3353+ confdDir = conf + '.d'
3354+ if os.path.isdir(confdDir):
3355+ for cf in os.listdir(confdDir):
3356+ cfpath = os.path.join(confdDir, cf)
3357+ if os.path.isfile(cfpath) and cf.endswith('.conf'):
3358+ try:
3359+ with open(cfpath) as f:
3360+ exec(compile(f.read(), cfpath, 'exec'), settings['databases'])
3361+ except Exception as e:
3362+ # ignore broken files
3363+ sys.stderr.write('Invalid file %s: %s\n' % (cfpath, str(e)))
3364+ pass
3365+
3366+ if not name:
3367+ name = settings['default']
3368+
3369+ return load_crashdb(auth_file, settings['databases'][name])
3370+
3371+
3372+def load_crashdb(auth_file, spec):
3373+ '''Return a CrashDatabase object for a given DB specification.
3374+
3375+ spec is a crash db configuration dictionary as described in get_crashdb().
3376+ '''
3377+ m = __import__('apport.crashdb_impl.' + spec['impl'], globals(), locals(), ['CrashDatabase'])
3378+ return m.CrashDatabase(auth_file, spec)
3379+
3380+
3381+class NeedsCredentials(Exception):
3382+ '''This may be raised when unable to log in to the crashdb.'''
3383+ pass
3384
3385=== added directory 'apport/crashdb_impl'
3386=== added file 'apport/crashdb_impl/__init__.py'
3387=== added file 'apport/crashdb_impl/debian.py'
3388--- apport/crashdb_impl/debian.py 1970-01-01 00:00:00 +0000
3389+++ apport/crashdb_impl/debian.py 2013-03-13 18:57:21 +0000
3390@@ -0,0 +1,113 @@
3391+'''Debian crash database interface.'''
3392+
3393+# Debian adaptation Copyright (C) 2012 Ritesh Raj Sarraf <rrs@debian.org>
3394+#
3395+# This program is free software; you can redistribute it and/or modify it
3396+# under the terms of the GNU General Public License as published by the
3397+# Free Software Foundation; either version 2 of the License, or (at your
3398+# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
3399+# the full text of the license.
3400+
3401+
3402+import smtplib, tempfile
3403+from email.mime.text import MIMEText
3404+
3405+import apport
3406+import apport.crashdb
3407+
3408+
3409+class CrashDatabase(apport.crashdb.CrashDatabase):
3410+ '''
3411+ Debian crash database
3412+ This is a Apport CrashDB implementation for interacting with Debian BTS
3413+ '''
3414+ def __init__(self, auth_file, options):
3415+ '''
3416+ Initialize crash database connection.
3417+
3418+ Debian implementation is pretty basic as most of its bug management
3419+ processes revolve around the email interface
3420+ '''
3421+ apport.crashdb.CrashDatabase.__init__(self, auth_file, options)
3422+ self.options = options
3423+
3424+ if not self.options.get('smtphost'):
3425+ self.options['smtphost'] = 'reportbug.debian.org'
3426+
3427+ if not self.options.get('recipient'):
3428+ self.options['recipient'] = 'submit@bugs.debian.org'
3429+
3430+ def accepts(self, report):
3431+ '''
3432+ Check if this report can be uploaded to this database.
3433+ Checks for the proper settings of apport.
3434+ '''
3435+ if not self.options.get('sender') and 'UnreportableReason' not in report:
3436+ report['UnreportableReason'] = 'Please configure sender settings in /etc/apport/crashdb.conf'
3437+
3438+ # At this time, we are not ready to take CrashDumps
3439+ if 'Stacktrace' in report and not report.has_useful_stacktrace():
3440+ report['UnreportableReason'] = 'Incomplete backtrace. Please install the debug symbol packages'
3441+
3442+ return apport.crashdb.CrashDatabase.accepts(self, report)
3443+
3444+ def upload(self, report, progress_callback=None):
3445+ '''Upload given problem report return a handle for it.
3446+
3447+ In Debian, we use BTS, which is heavily email oriented
3448+ This method crafts the bug into an email report understood by Debian BTS
3449+ '''
3450+ # first and foremost, let's check if the apport bug filing settings are set correct
3451+ assert self.accepts(report)
3452+
3453+ # Frame the report in the format the BTS understands
3454+ try:
3455+ (buggyPackage, buggyVersion) = report['Package'].split(' ')
3456+ except (KeyError, ValueError):
3457+ return False
3458+
3459+ temp = tempfile.NamedTemporaryFile()
3460+
3461+ temp.file.write(('Package: ' + buggyPackage + '\n').encode('UTF-8'))
3462+ temp.file.write(('Version: ' + buggyVersion + '\n\n\n').encode('UTF-8'))
3463+ temp.file.write(('=============================\n\n').encode('UTF-8'))
3464+
3465+ # Let's remove the CoreDump first
3466+
3467+ # Even if we have a valid backtrace, we already are reporting it as text
3468+ # We don't want to send very large emails to the BTS.
3469+ # OTOH, if the backtrace is invalid, has_useful_backtrace() will already
3470+ # deny reporting of the bug report.
3471+ try:
3472+ del report['CoreDump']
3473+ except KeyError:
3474+ pass
3475+
3476+ # Now write the apport bug report
3477+ report.write(temp)
3478+
3479+ temp.file.seek(0)
3480+
3481+ msg = MIMEText(temp.file.read().decode('UTF-8'))
3482+ msg['Subject'] = report['Title']
3483+ msg['From'] = self.options['sender']
3484+ msg['To'] = self.options['recipient']
3485+
3486+ # Subscribe the submitted to the bug report
3487+ msg.add_header('X-Debbugs-CC', self.options['sender'])
3488+ msg.add_header('Usertag', 'apport-%s' % report['ProblemType'].lower())
3489+
3490+ s = smtplib.SMTP(self.options['smtphost'])
3491+ s.sendmail(self.options['sender'], self.options['recipient'], msg.as_string().encode('UTF-8'))
3492+ s.quit()
3493+
3494+ def get_comment_url(self, report, handle):
3495+ '''
3496+ Return an URL that should be opened after report has been uploaded
3497+ and upload() returned handle.
3498+
3499+ Should return None if no URL should be opened (anonymous filing without
3500+ user comments); in that case this function should do whichever
3501+ interactive steps it wants to perform.
3502+ '''
3503+ return None
3504
3505=== added file 'apport/crashdb_impl/launchpad.py'
3506--- apport/crashdb_impl/launchpad.py 1970-01-01 00:00:00 +0000
3507+++ apport/crashdb_impl/launchpad.py 2013-03-13 18:57:21 +0000
3508@@ -0,0 +1,1993 @@
3509+# vim: set fileencoding=UTF-8 :
3510+'''Crash database implementation for Launchpad.'''
3511+
3512+# Copyright (C) 2007 - 2009 Canonical Ltd.
3513+# Authors: Martin Pitt <martin.pitt@ubuntu.com> and Markus Korn <thekorn@gmx.de>
3514+#
3515+# This program is free software; you can redistribute it and/or modify it
3516+# under the terms of the GNU General Public License as published by the
3517+# Free Software Foundation; either version 2 of the License, or (at your
3518+# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
3519+# the full text of the license.
3520+
3521+import tempfile, os.path, re, gzip, sys, email, time
3522+
3523+from io import BytesIO
3524+
3525+if sys.version_info.major == 2:
3526+ from urllib2 import HTTPSHandler, Request, build_opener
3527+ from httplib import HTTPSConnection
3528+ from urllib import urlencode, urlopen
3529+ (HTTPSHandler, Request, build_opener, HTTPSConnection, urlencode, urlopen) # pyflakes
3530+ _python2 = True
3531+else:
3532+ from urllib.request import HTTPSHandler, Request, build_opener, urlopen
3533+ from urllib.parse import urlencode
3534+ from http.client import HTTPSConnection
3535+ _python2 = False
3536+
3537+try:
3538+ from launchpadlib.errors import HTTPError
3539+ from launchpadlib.launchpad import Launchpad
3540+ Launchpad # pyflakes
3541+except ImportError:
3542+ # if launchpadlib is not available, only client-side reporting will work
3543+ Launchpad = None
3544+
3545+import apport.crashdb
3546+import apport
3547+
3548+default_credentials_path = os.path.expanduser('~/.cache/apport/launchpad.credentials')
3549+
3550+
3551+def filter_filename(attachments):
3552+ for attachment in attachments:
3553+ try:
3554+ f = attachment.data.open()
3555+ except HTTPError:
3556+ apport.error('Broken attachment on bug, ignoring')
3557+ continue
3558+ name = f.filename
3559+ if name.endswith('.txt') or name.endswith('.gz'):
3560+ yield f
3561+
3562+
3563+def id_set(tasks):
3564+ # same as set(int(i.bug.id) for i in tasks) but faster
3565+ return set(int(i.self_link.split('/').pop()) for i in tasks)
3566+
3567+
3568+class CrashDatabase(apport.crashdb.CrashDatabase):
3569+ '''Launchpad implementation of crash database interface.'''
3570+
3571+ def __init__(self, auth, options):
3572+ '''Initialize Launchpad crash database.
3573+
3574+ You need to specify a launchpadlib-style credentials file to
3575+ access launchpad. If you supply None, it will use
3576+ default_credentials_path (~/.cache/apport/launchpad.credentials).
3577+
3578+ Recognized options are:
3579+ - distro: Name of the distribution in Launchpad
3580+ - project: Name of the project in Launchpad
3581+ (Note that exactly one of "distro" or "project" must be given.)
3582+ - launchpad_instance: If set, this uses the given launchpad instance
3583+ instead of production (optional). This can be overriden or set by
3584+ $APPORT_LAUNCHPAD_INSTANCE environment.
3585+ - cache_dir: Path to a permanent cache directory; by default it uses a
3586+ temporary one. (optional). This can be overridden or set by
3587+ $APPORT_LAUNCHPAD_CACHE environment.
3588+ - escalation_subscription: This subscribes the given person or team to
3589+ a bug once it gets the 10th duplicate.
3590+ - escalation_tag: This adds the given tag to a bug once it gets more
3591+ than 10 duplicates.
3592+ - initial_subscriber: The Launchpad user which gets subscribed to newly
3593+ filed bugs (default: "apport"). It should be a bot user which the
3594+ crash-digger instance runs as, as this will get to see all bug
3595+ details immediately.
3596+ - triaging_team: The Launchpad user/team which gets subscribed after
3597+ updating a crash report bug by the retracer (default:
3598+ "ubuntu-crashes-universe")
3599+ - architecture: If set, this sets and watches out for needs-*-retrace
3600+ tags of this architecture. This is useful when being used with
3601+ apport-retrace and crash-digger to process crash reports of foreign
3602+ architectures. Defaults to system architecture.
3603+ '''
3604+ if os.getenv('APPORT_LAUNCHPAD_INSTANCE'):
3605+ options['launchpad_instance'] = os.getenv(
3606+ 'APPORT_LAUNCHPAD_INSTANCE')
3607+ if not auth:
3608+ lp_instance = options.get('launchpad_instance')
3609+ if lp_instance:
3610+ auth = default_credentials_path + '.' + lp_instance.split('://', 1)[-1]
3611+ else:
3612+ auth = default_credentials_path
3613+ apport.crashdb.CrashDatabase.__init__(self, auth, options)
3614+
3615+ self.distro = options.get('distro')
3616+ if self.distro:
3617+ assert 'project' not in options, 'Must not set both "project" and "distro" option'
3618+ else:
3619+ assert 'project' in options, 'Need to have either "project" or "distro" option'
3620+
3621+ if 'architecture' in options:
3622+ self.arch_tag = 'need-%s-retrace' % options['architecture']
3623+ else:
3624+ self.arch_tag = 'need-%s-retrace' % apport.packaging.get_system_architecture()
3625+ self.options = options
3626+ self.auth = auth
3627+ assert self.auth
3628+
3629+ self.__launchpad = None
3630+ self.__lp_distro = None
3631+ self.__lpcache = os.getenv('APPORT_LAUNCHPAD_CACHE', options.get('cache_dir'))
3632+
3633+ @property
3634+ def launchpad(self):
3635+ '''Return Launchpad instance.'''
3636+
3637+ if self.__launchpad:
3638+ return self.__launchpad
3639+
3640+ if Launchpad is None:
3641+ sys.stderr.write('ERROR: The launchpadlib Python module is not installed. This functionality is not available.\n')
3642+ sys.exit(1)
3643+
3644+ if self.options.get('launchpad_instance'):
3645+ launchpad_instance = self.options.get('launchpad_instance')
3646+ else:
3647+ launchpad_instance = 'production'
3648+
3649+ auth_dir = os.path.dirname(self.auth)
3650+ if auth_dir and not os.path.isdir(auth_dir):
3651+ os.makedirs(auth_dir)
3652+
3653+ try:
3654+ self.__launchpad = Launchpad.login_with('apport-collect',
3655+ launchpad_instance,
3656+ launchpadlib_dir=self.__lpcache,
3657+ allow_access_levels=['WRITE_PRIVATE'],
3658+ credentials_file=self.auth,
3659+ version='1.0')
3660+ except Exception as e:
3661+ if hasattr(e, 'content'):
3662+ msg = e.content
3663+ else:
3664+ msg = str(e)
3665+ apport.error('connecting to Launchpad failed: %s\nYou can reset the credentials by removing the file "%s"', msg, self.auth)
3666+ sys.exit(99) # transient error
3667+
3668+ return self.__launchpad
3669+
3670+ def _get_distro_tasks(self, tasks):
3671+ if not self.distro:
3672+ raise StopIteration
3673+
3674+ for t in tasks:
3675+ if t.bug_target_name.lower() == self.distro or \
3676+ re.match('^.+\(%s.*\)$' % self.distro, t.bug_target_name.lower()):
3677+ yield t
3678+
3679+ @property
3680+ def lp_distro(self):
3681+ if self.__lp_distro is None:
3682+ if self.distro:
3683+ self.__lp_distro = self.launchpad.distributions[self.distro]
3684+ elif 'project' in self.options:
3685+ self.__lp_distro = self.launchpad.projects[self.options['project']]
3686+ else:
3687+ raise SystemError('distro or project needs to be specified in crashdb options')
3688+
3689+ return self.__lp_distro
3690+
3691+ def upload(self, report, progress_callback=None):
3692+ '''Upload given problem report return a handle for it.
3693+
3694+ This should happen noninteractively.
3695+
3696+ If the implementation supports it, and a function progress_callback is
3697+ passed, that is called repeatedly with two arguments: the number of
3698+ bytes already sent, and the total number of bytes to send. This can be
3699+ used to provide a proper upload progress indication on frontends.
3700+ '''
3701+ assert self.accepts(report)
3702+
3703+ blob_file = self._generate_upload_blob(report)
3704+ ticket = upload_blob(blob_file, progress_callback, hostname=self.get_hostname())
3705+ blob_file.close()
3706+ assert ticket
3707+ return ticket
3708+
3709+ def get_hostname(self):
3710+ '''Return the hostname for the Launchpad instance.'''
3711+
3712+ launchpad_instance = self.options.get('launchpad_instance')
3713+ if launchpad_instance:
3714+ if launchpad_instance == 'staging':
3715+ hostname = 'staging.launchpad.net'
3716+ else:
3717+ hostname = 'launchpad.dev'
3718+ else:
3719+ hostname = 'launchpad.net'
3720+ return hostname
3721+
3722+ def get_comment_url(self, report, handle):
3723+ '''Return an URL that should be opened after report has been uploaded
3724+ and upload() returned handle.
3725+
3726+ Should return None if no URL should be opened (anonymous filing without
3727+ user comments); in that case this function should do whichever
3728+ interactive steps it wants to perform.'''
3729+
3730+ args = {}
3731+ title = report.get('Title', report.standard_title())
3732+ if title:
3733+ # always use UTF-8 encoding, urlencode() blows up otherwise in
3734+ # python 2.7
3735+ if type(title) != type(b''):
3736+ title = title.encode('UTF-8')
3737+ args['field.title'] = title
3738+
3739+ hostname = self.get_hostname()
3740+
3741+ project = self.options.get('project')
3742+
3743+ if not project:
3744+ if 'SourcePackage' in report:
3745+ return 'https://bugs.%s/%s/+source/%s/+filebug/%s?%s' % (
3746+ hostname, self.distro, report['SourcePackage'], handle, urlencode(args))
3747+ else:
3748+ return 'https://bugs.%s/%s/+filebug/%s?%s' % (
3749+ hostname, self.distro, handle, urlencode(args))
3750+ else:
3751+ return 'https://bugs.%s/%s/+filebug/%s?%s' % (
3752+ hostname, project, handle, urlencode(args))
3753+
3754+ def get_id_url(self, report, id):
3755+ '''Return URL for a given report ID.
3756+
3757+ The report is passed in case building the URL needs additional
3758+ information from it, such as the SourcePackage name.
3759+
3760+ Return None if URL is not available or cannot be determined.
3761+ '''
3762+ return 'https://bugs.launchpad.net/bugs/' + str(id)
3763+
3764+ def download(self, id):
3765+ '''Download the problem report from given ID and return a Report.'''
3766+
3767+ report = apport.Report()
3768+ b = self.launchpad.bugs[id]
3769+
3770+ # parse out fields from summary
3771+ m = re.search(r'(ProblemType:.*)$', b.description, re.S)
3772+ if not m:
3773+ m = re.search(r'^--- \r?$[\r\n]*(.*)', b.description, re.M | re.S)
3774+ assert m, 'bug description must contain standard apport format data'
3775+
3776+ description = m.group(1).encode('UTF-8').replace('\xc2\xa0', ' ').replace('\r\n', '\n')
3777+
3778+ if '\n\n' in description:
3779+ # this often happens, remove all empty lines between top and
3780+ # 'Uname'
3781+ if 'Uname:' in description:
3782+ # this will take care of bugs like LP #315728 where stuff
3783+ # is added after the apport data
3784+ (part1, part2) = description.split('Uname:', 1)
3785+ description = part1.replace('\n\n', '\n') + 'Uname:' \
3786+ + part2.split('\n\n', 1)[0]
3787+ else:
3788+ # just parse out the Apport block; e. g. LP #269539
3789+ description = description.split('\n\n', 1)[0]
3790+
3791+ report.load(BytesIO(description))
3792+
3793+ if 'Date' not in report:
3794+ # We had not submitted this field for a while, claiming it
3795+ # redundant. But it is indeed required for up-to-the-minute
3796+ # comparison with log files, etc. For backwards compatibility with
3797+ # those reported bugs, read the creation date
3798+ try:
3799+ report['Date'] = b.date_created.ctime()
3800+ except AttributeError:
3801+ # support older wadllib API which returned strings
3802+ report['Date'] = b.date_created
3803+ if 'ProblemType' not in report:
3804+ if 'apport-bug' in b.tags:
3805+ report['ProblemType'] = 'Bug'
3806+ elif 'apport-crash' in b.tags:
3807+ report['ProblemType'] = 'Crash'
3808+ elif 'apport-kernelcrash' in b.tags:
3809+ report['ProblemType'] = 'KernelCrash'
3810+ elif 'apport-package' in b.tags:
3811+ report['ProblemType'] = 'Package'
3812+ else:
3813+ raise ValueError('cannot determine ProblemType from tags: ' + str(b.tags))
3814+
3815+ report['Tags'] = ' '.join(b.tags)
3816+
3817+ if 'Title' in report:
3818+ report['OriginalTitle'] = report['Title']
3819+
3820+ report['Title'] = b.title
3821+
3822+ for attachment in filter_filename(b.attachments):
3823+ key, ext = os.path.splitext(attachment.filename)
3824+ # ignore attachments with invalid keys
3825+ try:
3826+ report[key] = ''
3827+ except:
3828+ continue
3829+ if ext == '.txt':
3830+ report[key] = attachment.read()
3831+ elif ext == '.gz':
3832+ try:
3833+ report[key] = gzip.GzipFile(fileobj=attachment).read()
3834+ except IOError as e:
3835+ # some attachments are only called .gz, but are
3836+ # uncompressed (LP #574360)
3837+ if 'Not a gzip' not in str(e):
3838+ raise
3839+ attachment.seek(0)
3840+ report[key] = attachment.read()
3841+ else:
3842+ raise Exception('Unknown attachment type: ' + attachment.filename)
3843+ return report
3844+
3845+ def update(self, id, report, comment, change_description=False,
3846+ attachment_comment=None, key_filter=None):
3847+ '''Update the given report ID with all data from report.
3848+
3849+ This creates a text comment with the "short" data (see
3850+ ProblemReport.write_mime()), and creates attachments for all the
3851+ bulk/binary data.
3852+
3853+ If change_description is True, and the crash db implementation supports
3854+ it, the short data will be put into the description instead (like in a
3855+ new bug).
3856+
3857+ comment will be added to the "short" data. If attachment_comment is
3858+ given, it will be added to the attachment uploads.
3859+
3860+ If key_filter is a list or set, then only those keys will be added.
3861+ '''
3862+ bug = self.launchpad.bugs[id]
3863+
3864+ if key_filter:
3865+ skip_keys = set(report.keys()) - set(key_filter)
3866+ else:
3867+ skip_keys = None
3868+
3869+ # we want to reuse the knowledge of write_mime() with all its different input
3870+ # types and output formatting; however, we have to dissect the mime ourselves,
3871+ # since we can't just upload it as a blob
3872+ mime = tempfile.TemporaryFile()
3873+ report.write_mime(mime, skip_keys=skip_keys)
3874+ mime.flush()
3875+ mime.seek(0)
3876+ msg = email.message_from_file(mime)
3877+ msg_iter = msg.walk()
3878+
3879+ # first part is the multipart container
3880+ part = msg_iter.next()
3881+ assert part.is_multipart()
3882+
3883+ # second part should be an inline text/plain attachments with all short
3884+ # fields
3885+ part = msg_iter.next()
3886+ assert not part.is_multipart()
3887+ assert part.get_content_type() == 'text/plain'
3888+
3889+ if not key_filter:
3890+ # when we update a complete report, we are updating an existing bug
3891+ # with apport-collect
3892+ x = bug.tags[:] # LP#254901 workaround
3893+ x.append('apport-collected')
3894+ # add any tags (like the release) to the bug
3895+ if 'Tags' in report:
3896+ x += self._filter_tag_names(report['Tags']).split()
3897+ bug.tags = x
3898+ bug.lp_save()
3899+ bug = self.launchpad.bugs[id] # fresh bug object, LP#336866 workaround
3900+
3901+ # short text data
3902+ if change_description:
3903+ bug.description = bug.description + '\n--- \n' + part.get_payload(decode=True).decode('UTF-8', 'replace')
3904+ bug.lp_save()
3905+ else:
3906+ bug.newMessage(content=part.get_payload(decode=True), subject=comment)
3907+
3908+ # other parts are the attachments:
3909+ for part in msg_iter:
3910+ # print ' attachment: %s...' % part.get_filename()
3911+ bug.addAttachment(comment=attachment_comment or '',
3912+ description=part.get_filename(),
3913+ content_type=None,
3914+ data=part.get_payload(decode=True),
3915+ filename=part.get_filename(), is_patch=False)
3916+
3917+ def update_traces(self, id, report, comment=''):
3918+ '''Update the given report ID for retracing results.
3919+
3920+ This updates Stacktrace, ThreadStacktrace, StacktraceTop,
3921+ and StacktraceSource. You can also supply an additional comment.
3922+ '''
3923+ apport.crashdb.CrashDatabase.update_traces(self, id, report, comment)
3924+
3925+ bug = self.launchpad.bugs[id]
3926+ # ensure it's assigned to a package
3927+ if 'SourcePackage' in report:
3928+ for task in bug.bug_tasks:
3929+ if task.target.resource_type_link.endswith('#distribution'):
3930+ task.target = self.lp_distro.getSourcePackage(name=report['SourcePackage'])
3931+ task.lp_save()
3932+ bug = self.launchpad.bugs[id]
3933+ break
3934+
3935+ # remove core dump if stack trace is usable
3936+ if report.has_useful_stacktrace():
3937+ for a in bug.attachments:
3938+ if a.title == 'CoreDump.gz':
3939+ try:
3940+ a.removeFromBug()
3941+ except HTTPError:
3942+ pass # LP#249950 workaround
3943+ try:
3944+ task = self._get_distro_tasks(bug.bug_tasks).next()
3945+ if task.importance == 'Undecided':
3946+ task.importance = 'Medium'
3947+ task.lp_save()
3948+ except StopIteration:
3949+ pass # no distro tasks
3950+
3951+ # update bug title with retraced function name
3952+ fn = report.stacktrace_top_function()
3953+ if fn:
3954+ m = re.match('^(.*crashed with SIG.* in )([^( ]+)(\(\).*$)', bug.title)
3955+ if m and m.group(2) != fn:
3956+ bug.title = m.group(1) + fn + m.group(3)
3957+ try:
3958+ bug.lp_save()
3959+ except HTTPError:
3960+ pass # LP#336866 workaround
3961+ bug = self.launchpad.bugs[id]
3962+
3963+ self._subscribe_triaging_team(bug, report)
3964+
3965+ def get_distro_release(self, id):
3966+ '''Get 'DistroRelease: <release>' from the given report ID and return
3967+ it.'''
3968+ bug = self.launchpad.bugs[id]
3969+ m = re.search('DistroRelease: ([-a-zA-Z0-9.+/ ]+)', bug.description)
3970+ if m:
3971+ return m.group(1)
3972+ raise ValueError('URL does not contain DistroRelease: field')
3973+
3974+ def get_affected_packages(self, id):
3975+ '''Return list of affected source packages for given ID.'''
3976+
3977+ bug_target_re = re.compile(
3978+ r'/%s/(?:(?P<suite>[^/]+)/)?\+source/(?P<source>[^/]+)$' % self.distro)
3979+
3980+ bug = self.launchpad.bugs[id]
3981+ result = []
3982+
3983+ for task in bug.bug_tasks:
3984+ match = bug_target_re.search(task.target.self_link)
3985+ if not match:
3986+ continue
3987+ if task.status in ('Invalid', "Won't Fix", 'Fix Released'):
3988+ continue
3989+ result.append(match.group('source'))
3990+ return result
3991+
3992+ def is_reporter(self, id):
3993+ '''Check whether the user is the reporter of given ID.'''
3994+
3995+ bug = self.launchpad.bugs[id]
3996+ return bug.owner.name == self.launchpad.me.name
3997+
3998+ def can_update(self, id):
3999+ '''Check whether the user is eligible to update a report.
4000+
4001+ A user should add additional information to an existing ID if (s)he is
4002+ the reporter or subscribed, the bug is open, not a duplicate, etc. The
4003+ exact policy and checks should be done according to the particular
4004+ implementation.
4005+ '''
4006+ bug = self.launchpad.bugs[id]
4007+ if bug.duplicate_of:
4008+ return False
4009+
4010+ if bug.owner.name == self.launchpad.me.name:
4011+ return True
4012+
4013+ # check subscription
4014+ me = self.launchpad.me.self_link
4015+ for sub in bug.subscriptions.entries:
4016+ if sub['person_link'] == me:
4017+ return True
4018+
4019+ return False
4020+
4021+ def get_unretraced(self):
4022+ '''Return an ID set of all crashes which have not been retraced yet and
4023+ which happened on the current host architecture.'''
4024+ try:
4025+ bugs = self.lp_distro.searchTasks(tags=self.arch_tag, created_since='2011-08-01')
4026+ return id_set(bugs)
4027+ except Exception as e:
4028+ apport.error('connecting to Launchpad failed: %s', str(e))
4029+ sys.exit(99) # transient error
4030+
4031+ def get_dup_unchecked(self):
4032+ '''Return an ID set of all crashes which have not been checked for
4033+ being a duplicate.
4034+
4035+ This is mainly useful for crashes of scripting languages such as
4036+ Python, since they do not need to be retraced. It should not return
4037+ bugs that are covered by get_unretraced().'''
4038+
4039+ try:
4040+ bugs = self.lp_distro.searchTasks(tags='need-duplicate-check', created_since='2011-08-01')
4041+ return id_set(bugs)
4042+ except Exception as e:
4043+ apport.error('connecting to Launchpad failed: %s', str(e))
4044+ sys.exit(99) # transient error
4045+
4046+ def get_unfixed(self):
4047+ '''Return an ID set of all crashes which are not yet fixed.
4048+
4049+ The list must not contain bugs which were rejected or duplicate.
4050+
4051+ This function should make sure that the returned list is correct. If
4052+ there are any errors with connecting to the crash database, it should
4053+ raise an exception (preferably IOError).'''
4054+
4055+ bugs = self.lp_distro.searchTasks(tags='apport-crash')
4056+ return id_set(bugs)
4057+
4058+ def _get_source_version(self, package):
4059+ '''Return the version of given source package in the latest release of
4060+ given distribution.
4061+
4062+ If 'distro' is None, we will look for a launchpad project .
4063+ '''
4064+ sources = self.lp_distro.main_archive.getPublishedSources(
4065+ exact_match=True,
4066+ source_name=package,
4067+ distro_series=self.lp_distro.current_series
4068+ )
4069+ # first element is the latest one
4070+ return sources[0].source_package_version
4071+
4072+ def get_fixed_version(self, id):
4073+ '''Return the package version that fixes a given crash.
4074+
4075+ Return None if the crash is not yet fixed, or an empty string if the
4076+ crash is fixed, but it cannot be determined by which version. Return
4077+ 'invalid' if the crash report got invalidated, such as closed a
4078+ duplicate or rejected.
4079+
4080+ This function should make sure that the returned result is correct. If
4081+ there are any errors with connecting to the crash database, it should
4082+ raise an exception (preferably IOError).
4083+ '''
4084+ # do not do version tracking yet; for that, we need to get the current
4085+ # distrorelease and the current package version in that distrorelease
4086+ # (or, of course, proper version tracking in Launchpad itself)
4087+
4088+ try:
4089+ b = self.launchpad.bugs[id]
4090+ except KeyError:
4091+ return 'invalid'
4092+
4093+ if b.duplicate_of:
4094+ return 'invalid'
4095+
4096+ tasks = list(b.bug_tasks) # just fetch it once
4097+
4098+ if self.distro:
4099+ distro_identifier = '(%s)' % self.distro.lower()
4100+ fixed_tasks = filter(lambda task: task.status == 'Fix Released' and
4101+ distro_identifier in task.bug_target_display_name.lower(), tasks)
4102+
4103+ if not fixed_tasks:
4104+ fixed_distro = filter(lambda task: task.status == 'Fix Released' and
4105+ task.bug_target_name.lower() == self.distro.lower(), tasks)
4106+ if fixed_distro:
4107+ # fixed in distro inself (without source package)
4108+ return ''
4109+
4110+ if len(fixed_tasks) > 1:
4111+ apport.warning('There is more than one task fixed in %s %s, using first one to determine fixed version', self.distro, id)
4112+ return ''
4113+
4114+ if fixed_tasks:
4115+ task = fixed_tasks.pop()
4116+ try:
4117+ return self._get_source_version(task.bug_target_display_name.split()[0])
4118+ except IndexError:
4119+ # source does not exist any more
4120+ return 'invalid'
4121+ else:
4122+ # check if there only invalid ones
4123+ invalid_tasks = filter(lambda task: task.status in ('Invalid', "Won't Fix", 'Expired') and
4124+ distro_identifier in task.bug_target_display_name.lower(), tasks)
4125+ if invalid_tasks:
4126+ non_invalid_tasks = filter(
4127+ lambda task: task.status not in ('Invalid', "Won't Fix", 'Expired') and
4128+ distro_identifier in task.bug_target_display_name.lower(), tasks)
4129+ if not non_invalid_tasks:
4130+ return 'invalid'
4131+ else:
4132+ fixed_tasks = filter(lambda task: task.status == 'Fix Released', tasks)
4133+ if fixed_tasks:
4134+ # TODO: look for current series
4135+ return ''
4136+ # check if there any invalid ones
4137+ if filter(lambda task: task.status == 'Invalid', tasks):
4138+ return 'invalid'
4139+
4140+ return None
4141+
4142+ def duplicate_of(self, id):
4143+ '''Return master ID for a duplicate bug.
4144+
4145+ If the bug is not a duplicate, return None.
4146+ '''
4147+ b = self.launchpad.bugs[id].duplicate_of
4148+ if b:
4149+ return b.id
4150+ else:
4151+ return None
4152+
4153+ def close_duplicate(self, report, id, master_id):
4154+ '''Mark a crash id as duplicate of given master ID.
4155+
4156+ If master is None, id gets un-duplicated.
4157+ '''
4158+ bug = self.launchpad.bugs[id]
4159+
4160+ if master_id:
4161+ assert id != master_id, 'cannot mark bug %s as a duplicate of itself' % str(id)
4162+
4163+ # check whether the master itself is a dup
4164+ master = self.launchpad.bugs[master_id]
4165+ if master.duplicate_of:
4166+ master = master.duplicate_of
4167+ master_id = master.id
4168+ if master.id == id:
4169+ # this happens if the bug was manually duped to a newer one
4170+ apport.warning('Bug %i was manually marked as a dupe of newer bug %i, not closing as duplicate',
4171+ id, master_id)
4172+ return
4173+
4174+ for a in bug.attachments:
4175+ if a.title in ('CoreDump.gz', 'Stacktrace.txt',
4176+ 'ThreadStacktrace.txt', 'ProcMaps.txt',
4177+ 'ProcStatus.txt', 'Registers.txt',
4178+ 'Disassembly.txt'):
4179+ try:
4180+ a.removeFromBug()
4181+ except HTTPError:
4182+ pass # LP#249950 workaround
4183+
4184+ bug = self.launchpad.bugs[id] # fresh bug object, LP#336866 workaround
4185+ bug.newMessage(content='Thank you for taking the time to report this crash and helping \
4186+to make this software better. This particular crash has already been reported and \
4187+is a duplicate of bug #%i, so is being marked as such. Please look at the \
4188+other bug report to see if there is any missing information that you can \
4189+provide, or to see if there is a workaround for the bug. Additionally, any \
4190+further discussion regarding the bug should occur in the other report. \
4191+Please continue to report any other bugs you may find.' % master_id,
4192+ subject='This bug is a duplicate')
4193+
4194+ bug = self.launchpad.bugs[id] # refresh, LP#336866 workaround
4195+ if bug.private:
4196+ bug.private = False
4197+
4198+ # set duplicate last, since we cannot modify already dup'ed bugs
4199+ if not bug.duplicate_of:
4200+ bug.duplicate_of = master
4201+
4202+ # cache tags of master bug report instead of performing multiple
4203+ # queries
4204+ master_tags = master.tags
4205+
4206+ if len(master.duplicates) == 10:
4207+ if 'escalation_tag' in self.options and self.options['escalation_tag'] not in master_tags and self.options.get('escalated_tag', ' invalid ') not in master_tags:
4208+ master.tags = master_tags + [self.options['escalation_tag']] # LP#254901 workaround
4209+ master.lp_save()
4210+
4211+ if 'escalation_subscription' in self.options and self.options.get('escalated_tag', ' invalid ') not in master_tags:
4212+ p = self.launchpad.people[self.options['escalation_subscription']]
4213+ master.subscribe(person=p)
4214+
4215+ # requesting updated stack trace?
4216+ if report.has_useful_stacktrace() and ('apport-request-retrace' in master_tags
4217+ or 'apport-failed-retrace' in master_tags):
4218+ self.update(master_id, report, 'Updated stack trace from duplicate bug %i' % id,
4219+ key_filter=['Stacktrace', 'ThreadStacktrace',
4220+ 'Package', 'Dependencies', 'ProcMaps', 'ProcCmdline'])
4221+
4222+ master = self.launchpad.bugs[master_id]
4223+ x = master.tags[:] # LP#254901 workaround
4224+ try:
4225+ x.remove('apport-failed-retrace')
4226+ except ValueError:
4227+ pass
4228+ try:
4229+ x.remove('apport-request-retrace')
4230+ except ValueError:
4231+ pass
4232+ master.tags = x
4233+ try:
4234+ master.lp_save()
4235+ except HTTPError:
4236+ pass # LP#336866 workaround
4237+
4238+ # white list of tags to copy from duplicates bugs to the master
4239+ tags_to_copy = ['bugpattern-needed']
4240+ for series in self.lp_distro.series:
4241+ if series.status not in ['Active Development',
4242+ 'Current Stable Release',
4243+ 'Supported', 'Pre-release Freeze']:
4244+ continue
4245+ tags_to_copy.append(series.name)
4246+ # copy tags over from the duplicate bug to the master bug
4247+ dupe_tags = set(bug.tags)
4248+ # reload master tags as they may have changed
4249+ master_tags = master.tags
4250+ missing_tags = dupe_tags.difference(master_tags)
4251+
4252+ for tag in missing_tags:
4253+ if tag in tags_to_copy:
4254+ master_tags.append(tag)
4255+
4256+ master.tags = master_tags
4257+ master.lp_save()
4258+
4259+ else:
4260+ if bug.duplicate_of:
4261+ bug.duplicate_of = None
4262+
4263+ if bug._dirty_attributes: # LP#336866 workaround
4264+ bug.lp_save()
4265+
4266+ def mark_regression(self, id, master):
4267+ '''Mark a crash id as reintroducing an earlier crash which is
4268+ already marked as fixed (having ID 'master').'''
4269+
4270+ bug = self.launchpad.bugs[id]
4271+ bug.newMessage(content='This crash has the same stack trace characteristics as bug #%i. \
4272+However, the latter was already fixed in an earlier package version than the \
4273+one in this report. This might be a regression or because the problem is \
4274+in a dependent package.' % master,
4275+ subject='Possible regression detected')
4276+ bug = self.launchpad.bugs[id] # fresh bug object, LP#336866 workaround
4277+ bug.tags = bug.tags + ['regression-retracer'] # LP#254901 workaround
4278+ bug.lp_save()
4279+
4280+ def mark_retraced(self, id):
4281+ '''Mark crash id as retraced.'''
4282+
4283+ bug = self.launchpad.bugs[id]
4284+ if self.arch_tag in bug.tags:
4285+ x = bug.tags[:] # LP#254901 workaround
4286+ x.remove(self.arch_tag)
4287+ bug.tags = x
4288+ try:
4289+ bug.lp_save()
4290+ except HTTPError:
4291+ pass # LP#336866 workaround
4292+
4293+ def mark_retrace_failed(self, id, invalid_msg=None):
4294+ '''Mark crash id as 'failed to retrace'.'''
4295+
4296+ bug = self.launchpad.bugs[id]
4297+ if invalid_msg:
4298+ try:
4299+ task = self._get_distro_tasks(bug.bug_tasks).next()
4300+ except StopIteration:
4301+ # no distro task, just use the first one
4302+ task = bug.bug_tasks[0]
4303+ task.status = 'Invalid'
4304+ task.lp_save()
4305+ bug.newMessage(content=invalid_msg,
4306+ subject='Crash report cannot be processed')
4307+
4308+ for a in bug.attachments:
4309+ if a.title == 'CoreDump.gz':
4310+ try:
4311+ a.removeFromBug()
4312+ except HTTPError:
4313+ pass # LP#249950 workaround
4314+ else:
4315+ if 'apport-failed-retrace' not in bug.tags:
4316+ bug.tags = bug.tags + ['apport-failed-retrace'] # LP#254901 workaround
4317+ bug.lp_save()
4318+
4319+ def _mark_dup_checked(self, id, report):
4320+ '''Mark crash id as checked for being a duplicate.'''
4321+
4322+ bug = self.launchpad.bugs[id]
4323+
4324+ # if we have a distro task without a package, fix it
4325+ if 'SourcePackage' in report:
4326+ for task in bug.bug_tasks:
4327+ if task.target.resource_type_link.endswith('#distribution'):
4328+ task.target = self.lp_distro.getSourcePackage(
4329+ name=report['SourcePackage'])
4330+ task.lp_save()
4331+ bug = self.launchpad.bugs[id]
4332+ break
4333+
4334+ if 'need-duplicate-check' in bug.tags:
4335+ x = bug.tags[:] # LP#254901 workaround
4336+ x.remove('need-duplicate-check')
4337+ bug.tags = x
4338+ bug.lp_save()
4339+ if 'Traceback' in report:
4340+ for task in bug.bug_tasks:
4341+ if '#distribution' in task.target.resource_type_link:
4342+ if task.importance == 'Undecided':
4343+ task.importance = 'Medium'
4344+ task.lp_save()
4345+ self._subscribe_triaging_team(bug, report)
4346+
4347+ def known(self, report):
4348+ '''Check if the crash db already knows about the crash signature.
4349+
4350+ Check if the report has a DuplicateSignature, crash_signature(), or
4351+ StacktraceAddressSignature, and ask the database whether the problem is
4352+ already known. If so, return an URL where the user can check the status
4353+ or subscribe (if available), or just return True if the report is known
4354+ but there is no public URL. In that case the report will not be
4355+ uploaded (i. e. upload() will not be called).
4356+
4357+ Return None if the report does not have any signature or the crash
4358+ database does not support checking for duplicates on the client side.
4359+
4360+ The default implementation uses a text file format generated by
4361+ duplicate_db_publish() at an URL specified by the "dupdb_url" option.
4362+ Subclasses are free to override this with a custom implementation, such
4363+ as a real database lookup.
4364+ '''
4365+ # we override the method here to check if the user actually has access
4366+ # to the bug, and if the bug requests more retraces; in either case we
4367+ # should file it.
4368+ url = apport.crashdb.CrashDatabase.known(self, report)
4369+
4370+ if not url:
4371+ return url
4372+
4373+ # record the fact that it is a duplicate, for triagers
4374+ report['DuplicateOf'] = url
4375+
4376+ try:
4377+ f = urlopen(url + '/+text')
4378+ except IOError:
4379+ # if we are offline, or LP is down, upload will fail anyway, so we
4380+ # can just as well avoid the upload
4381+ return url
4382+
4383+ line = f.readline()
4384+ if not line.startswith(b'bug:'):
4385+ # presumably a 404 etc. page, which happens for private bugs
4386+ return True
4387+
4388+ # check tags
4389+ for line in f:
4390+ if line.startswith(b'tags:'):
4391+ if b'apport-failed-retrace' in line or b'apport-request-retrace' in line:
4392+ return None
4393+ else:
4394+ break
4395+
4396+ # stop at the first task, tags are in the first block
4397+ if not line.strip():
4398+ break
4399+
4400+ return url
4401+
4402+ def _subscribe_triaging_team(self, bug, report):
4403+ '''Subscribe the right triaging team to the bug.'''
4404+
4405+ #FIXME: this entire function is an ugly Ubuntu specific hack until LP
4406+ #gets a real crash db; see https://wiki.ubuntu.com/CrashReporting
4407+
4408+ if 'DistroRelease' in report and report['DistroRelease'].split()[0] != 'Ubuntu':
4409+ return # only Ubuntu bugs are filed private
4410+
4411+ #use a url hack here, it is faster
4412+ person = '%s~%s' % (self.launchpad._root_uri,
4413+ self.options.get('triaging_team', 'ubuntu-crashes-universe'))
4414+ bug.subscribe(person=person)
4415+
4416+ def _generate_upload_blob(self, report):
4417+ '''Generate a multipart/MIME temporary file for uploading.
4418+
4419+ You have to close the returned file object after you are done with it.
4420+ '''
4421+ # set reprocessing tags
4422+ hdr = {}
4423+ hdr['Tags'] = 'apport-%s' % report['ProblemType'].lower()
4424+ a = report.get('PackageArchitecture')
4425+ if not a or a == 'all':
4426+ a = report.get('Architecture')
4427+ if a:
4428+ hdr['Tags'] += ' ' + a
4429+ if 'Tags' in report:
4430+ hdr['Tags'] += ' ' + self._filter_tag_names(report['Tags'])
4431+
4432+ # privacy/retracing for distro reports
4433+ # FIXME: ugly hack until LP has a real crash db
4434+ if 'DistroRelease' in report:
4435+ if a and ('VmCore' in report or 'CoreDump' in report or 'LaunchpadPrivate' in report):
4436+ hdr['Private'] = 'yes'
4437+ hdr['Subscribers'] = report.get('LaunchpadSubscribe',
4438+ self.options.get('initial_subscriber', 'apport'))
4439+ hdr['Tags'] += ' need-%s-retrace' % a
4440+ elif 'Traceback' in report:
4441+ hdr['Private'] = 'yes'
4442+ hdr['Subscribers'] = 'apport'
4443+ hdr['Tags'] += ' need-duplicate-check'
4444+ if 'DuplicateSignature' in report and 'need-duplicate-check' not in hdr['Tags']:
4445+ hdr['Tags'] += ' need-duplicate-check'
4446+
4447+ # if we have checkbox submission key, link it to the bug; keep text
4448+ # reference until the link is shown in Launchpad's UI
4449+ if 'CheckboxSubmission' in report:
4450+ hdr['HWDB-Submission'] = report['CheckboxSubmission']
4451+
4452+ # order in which keys should appear in the temporary file
4453+ order = ['ProblemType', 'DistroRelease', 'Package', 'Regression', 'Reproducible',
4454+ 'TestedUpstream', 'ProcVersionSignature', 'Uname', 'NonfreeKernelModules']
4455+
4456+ # write MIME/Multipart version into temporary file
4457+ mime = tempfile.TemporaryFile()
4458+ report.write_mime(mime, extra_headers=hdr,
4459+ skip_keys=['Tags', 'LaunchpadPrivate', 'LaunchpadSubscribe'],
4460+ priority_fields=order)
4461+ mime.flush()
4462+ mime.seek(0)
4463+
4464+ return mime
4465+
4466+ @classmethod
4467+ def _filter_tag_names(klass, tags):
4468+ '''Replace characters from tags which are not palatable to Launchpad'''
4469+
4470+ res = ''
4471+ for ch in tags.lower().encode('ASCII', errors='ignore'):
4472+ if ch in b'abcdefghijklmnopqrstuvwxyz0123456789 ' or (len(res) > 0 and ch in b'+-.'):
4473+ if _python2:
4474+ res += ch
4475+ else:
4476+ res += chr(ch)
4477+ else:
4478+ res += '.'
4479+
4480+ return res
4481+
4482+#
4483+# Launchpad storeblob API (should go into launchpadlib, see LP #315358)
4484+#
4485+
4486+_https_upload_callback = None
4487+
4488+
4489+#
4490+# This progress code is based on KodakLoader by Jason Hildebrand
4491+# <jason@opensky.ca>. See http://www.opensky.ca/~jdhildeb/software/kodakloader/
4492+# for details.
4493+class HTTPSProgressConnection(HTTPSConnection):
4494+ '''Implement a HTTPSConnection with an optional callback function for
4495+ upload progress.'''
4496+
4497+ def send(self, data):
4498+ global _https_upload_callback
4499+
4500+ # if callback has not been set, call the old method
4501+ if not _https_upload_callback:
4502+ HTTPSConnection.send(self, data)
4503+ return
4504+
4505+ sent = 0
4506+ total = len(data)
4507+ chunksize = 1024
4508+ while sent < total:
4509+ _https_upload_callback(sent, total)
4510+ t1 = time.time()
4511+ HTTPSConnection.send(self, data[sent:(sent + chunksize)])
4512+ sent += chunksize
4513+ t2 = time.time()
4514+
4515+ # adjust chunksize so that it takes between .5 and 2
4516+ # seconds to send a chunk
4517+ if chunksize > 1024:
4518+ if t2 - t1 < .5:
4519+ chunksize <<= 1
4520+ elif t2 - t1 > 2:
4521+ chunksize >>= 1
4522+
4523+
4524+class HTTPSProgressHandler(HTTPSHandler):
4525+
4526+ def https_open(self, req):
4527+ return self.do_open(HTTPSProgressConnection, req)
4528+
4529+
4530+def upload_blob(blob, progress_callback=None, hostname='launchpad.net'):
4531+ '''Upload blob (file-like object) to Launchpad.
4532+
4533+ progress_callback can be set to a function(sent, total) which is regularly
4534+ called with the number of bytes already sent and total number of bytes to
4535+ send. It is called every 0.5 to 2 seconds (dynamically adapted to upload
4536+ bandwidth).
4537+
4538+ Return None on error, or the ticket number on success.
4539+
4540+ By default this uses the production Launchpad hostname. Set
4541+ hostname to 'launchpad.dev' or 'staging.launchpad.net' to use another
4542+ instance for testing.
4543+ '''
4544+ ticket = None
4545+ url = 'https://%s/+storeblob' % hostname
4546+
4547+ global _https_upload_callback
4548+ _https_upload_callback = progress_callback
4549+
4550+ # build the form-data multipart/MIME request
4551+ data = email.mime.multipart.MIMEMultipart()
4552+
4553+ submit = email.mime.text.MIMEText('1')
4554+ submit.add_header('Content-Disposition', 'form-data; name="FORM_SUBMIT"')
4555+ data.attach(submit)
4556+
4557+ form_blob = email.mime.base.MIMEBase('application', 'octet-stream')
4558+ form_blob.add_header('Content-Disposition', 'form-data; name="field.blob"; filename="x"')
4559+ form_blob.set_payload(blob.read().decode('ascii'))
4560+ data.attach(form_blob)
4561+
4562+ data_flat = BytesIO()
4563+ if sys.version_info.major == 2:
4564+ gen = email.generator.Generator(data_flat, mangle_from_=False)
4565+ else:
4566+ gen = email.generator.BytesGenerator(data_flat, mangle_from_=False)
4567+ gen.flatten(data)
4568+
4569+ # do the request; we need to explicitly set the content type here, as it
4570+ # defaults to x-www-form-urlencoded
4571+ req = Request(url, data_flat.getvalue())
4572+ req.add_header('Content-Type', 'multipart/form-data; boundary=' + data.get_boundary())
4573+ opener = build_opener(HTTPSProgressHandler)
4574+ result = opener.open(req)
4575+ ticket = result.info().get('X-Launchpad-Blob-Token')
4576+
4577+ assert ticket
4578+ return ticket
4579+
4580+#
4581+# Unit tests
4582+#
4583+
4584+if __name__ == '__main__':
4585+ import unittest, atexit, shutil, subprocess
4586+ import mock
4587+
4588+ crashdb = None
4589+ _segv_report = None
4590+ _python_report = None
4591+ _uncommon_description_report = None
4592+
4593+ class _T(unittest.TestCase):
4594+ # this assumes that a source package 'coreutils' exists and builds a
4595+ # binary package 'coreutils'
4596+ test_package = 'coreutils'
4597+ test_srcpackage = 'coreutils'
4598+
4599+ #
4600+ # Generic tests, should work for all CrashDB implementations
4601+ #
4602+
4603+ def setUp(self):
4604+ global crashdb
4605+ if not crashdb:
4606+ crashdb = self._get_instance()
4607+ self.crashdb = crashdb
4608+
4609+ # create a local reference report so that we can compare
4610+ # DistroRelease, Architecture, etc.
4611+ self.ref_report = apport.Report()
4612+ self.ref_report.add_os_info()
4613+ self.ref_report.add_user_info()
4614+ self.ref_report['SourcePackage'] = 'coreutils'
4615+
4616+ # Objects tests rely on.
4617+ self._create_project('langpack-o-matic')
4618+
4619+ def _create_project(self, name):
4620+ '''Create a project using launchpadlib to be used by tests.'''
4621+
4622+ project = self.crashdb.launchpad.projects[name]
4623+ if not project:
4624+ self.crashdb.launchpad.projects.new_project(
4625+ description=name + 'description',
4626+ display_name=name,
4627+ name=name,
4628+ summary=name + 'summary',
4629+ title=name + 'title')
4630+
4631+ @property
4632+ def hostname(self):
4633+ '''Get the Launchpad hostname for the given crashdb.'''
4634+
4635+ return self.crashdb.get_hostname()
4636+
4637+ def get_segv_report(self, force_fresh=False):
4638+ '''Generate SEGV crash report.
4639+
4640+ This is only done once, subsequent calls will return the already
4641+ existing ID, unless force_fresh is True.
4642+
4643+ Return the ID.
4644+ '''
4645+ global _segv_report
4646+ if not force_fresh and _segv_report is not None:
4647+ return _segv_report
4648+
4649+ r = self._generate_sigsegv_report()
4650+ r.add_package_info(self.test_package)
4651+ r.add_os_info()
4652+ r.add_gdb_info()
4653+ r.add_user_info()
4654+ self.assertEqual(r.standard_title(), 'crash crashed with SIGSEGV in f()')
4655+
4656+ # add some binary gibberish which isn't UTF-8
4657+ r['ShortGibberish'] = ' "]\xb6"\n'
4658+ r['LongGibberish'] = 'a\nb\nc\nd\ne\n\xff\xff\xff\n\f'
4659+
4660+ # create a bug for the report
4661+ bug_target = self._get_bug_target(self.crashdb, r)
4662+ self.assertTrue(bug_target)
4663+
4664+ id = self._file_bug(bug_target, r)
4665+ self.assertTrue(id > 0)
4666+
4667+ sys.stderr.write('(Created SEGV report: https://%s/bugs/%i) ' % (self.hostname, id))
4668+ if not force_fresh:
4669+ _segv_report = id
4670+ return id
4671+
4672+ def get_python_report(self):
4673+ '''Generate Python crash report.
4674+
4675+ Return the ID.
4676+ '''
4677+ global _python_report
4678+ if _python_report is not None:
4679+ return _python_report
4680+
4681+ r = apport.Report('Crash')
4682+ r['ExecutablePath'] = '/bin/foo'
4683+ r['Traceback'] = '''Traceback (most recent call last):
4684+ File "/bin/foo", line 67, in fuzz
4685+ print(weird)
4686+NameError: global name 'weird' is not defined'''
4687+ r['Tags'] = 'boogus pybogus'
4688+ r.add_package_info(self.test_package)
4689+ r.add_os_info()
4690+ r.add_user_info()
4691+ self.assertEqual(r.standard_title(),
4692+ "foo crashed with NameError in fuzz(): global name 'weird' is not defined")
4693+
4694+ bug_target = self._get_bug_target(self.crashdb, r)
4695+ self.assertTrue(bug_target)
4696+
4697+ id = self._file_bug(bug_target, r)
4698+ self.assertTrue(id > 0)
4699+ sys.stderr.write('(Created Python report: https://%s/bugs/%i) ' % (self.hostname, id))
4700+ _python_report = id
4701+ return id
4702+
4703+ def get_uncommon_description_report(self, force_fresh=False):
4704+ '''File a bug report with an uncommon description.
4705+
4706+ This is only done once, subsequent calls will return the already
4707+ existing ID, unless force_fresh is True.
4708+
4709+ Example taken from real LP bug 269539. It contains only
4710+ ProblemType/Architecture/DistroRelease in the description, and has
4711+ free-form description text after the Apport data.
4712+
4713+ Return the ID.
4714+ '''
4715+ global _uncommon_description_report
4716+ if not force_fresh and _uncommon_description_report is not None:
4717+ return _uncommon_description_report
4718+
4719+ desc = '''problem
4720+
4721+ProblemType: Package
4722+Architecture: amd64
4723+DistroRelease: Ubuntu 8.10
4724+
4725+more text
4726+
4727+and more
4728+'''
4729+ bug = self.crashdb.launchpad.bugs.createBug(
4730+ title=b'mixed description bug'.encode(),
4731+ description=desc,
4732+ target=self.crashdb.lp_distro)
4733+ sys.stderr.write('(Created uncommon description: https://%s/bugs/%i) ' % (self.hostname, bug.id))
4734+
4735+ if not force_fresh:
4736+ _uncommon_description_report = bug.id
4737+ return bug.id
4738+
4739+ def test_1_download(self):
4740+ '''download()'''
4741+
4742+ r = self.crashdb.download(self.get_segv_report())
4743+ self.assertEqual(r['ProblemType'], 'Crash')
4744+ self.assertEqual(r['Title'], 'crash crashed with SIGSEGV in f()')
4745+ self.assertEqual(r['DistroRelease'], self.ref_report['DistroRelease'])
4746+ self.assertEqual(r['Architecture'], self.ref_report['Architecture'])
4747+ self.assertEqual(r['Uname'], self.ref_report['Uname'])
4748+ self.assertEqual(r.get('NonfreeKernelModules'),
4749+ self.ref_report.get('NonfreeKernelModules'))
4750+ self.assertEqual(r.get('UserGroups'), self.ref_report.get('UserGroups'))
4751+ tags = set(r['Tags'].split())
4752+ self.assertEqual(tags, set([self.crashdb.arch_tag, 'apport-crash',
4753+ apport.packaging.get_system_architecture()]))
4754+
4755+ self.assertEqual(r['Signal'], '11')
4756+ self.assertTrue(r['ExecutablePath'].endswith('/crash'))
4757+ self.assertEqual(r['SourcePackage'], self.test_srcpackage)
4758+ self.assertTrue(r['Package'].startswith(self.test_package + ' '))
4759+ self.assertTrue('f (x=42)' in r['Stacktrace'])
4760+ self.assertTrue('f (x=42)' in r['StacktraceTop'])
4761+ self.assertTrue('f (x=42)' in r['ThreadStacktrace'])
4762+ self.assertTrue(len(r['CoreDump']) > 1000)
4763+ self.assertTrue('Dependencies' in r)
4764+ self.assertTrue('Disassembly' in r)
4765+ self.assertTrue('Registers' in r)
4766+
4767+ # check tags
4768+ r = self.crashdb.download(self.get_python_report())
4769+ tags = set(r['Tags'].split())
4770+ self.assertEqual(tags, set(['apport-crash', 'boogus', 'pybogus',
4771+ 'need-duplicate-check', apport.packaging.get_system_architecture()]))
4772+
4773+ def test_2_update_traces(self):
4774+ '''update_traces()'''
4775+
4776+ r = self.crashdb.download(self.get_segv_report())
4777+ self.assertTrue('CoreDump' in r)
4778+ self.assertTrue('Dependencies' in r)
4779+ self.assertTrue('Disassembly' in r)
4780+ self.assertTrue('Registers' in r)
4781+ self.assertTrue('Stacktrace' in r)
4782+ self.assertTrue('ThreadStacktrace' in r)
4783+ self.assertEqual(r['Title'], 'crash crashed with SIGSEGV in f()')
4784+
4785+ # updating with a useless stack trace retains core dump
4786+ r['StacktraceTop'] = '?? ()'
4787+ r['Stacktrace'] = 'long\ntrace'
4788+ r['ThreadStacktrace'] = 'thread\neven longer\ntrace'
4789+ r['FooBar'] = 'bogus'
4790+ self.crashdb.update_traces(self.get_segv_report(), r, 'I can has a better retrace?')
4791+ r = self.crashdb.download(self.get_segv_report())
4792+ self.assertTrue('CoreDump' in r)
4793+ self.assertTrue('Dependencies' in r)
4794+ self.assertTrue('Disassembly' in r)
4795+ self.assertTrue('Registers' in r)
4796+ self.assertTrue('Stacktrace' in r) # TODO: ascertain that it's the updated one
4797+ self.assertTrue('ThreadStacktrace' in r)
4798+ self.assertFalse('FooBar' in r)
4799+ self.assertEqual(r['Title'], 'crash crashed with SIGSEGV in f()')
4800+
4801+ tags = self.crashdb.launchpad.bugs[self.get_segv_report()].tags
4802+ self.assertTrue('apport-crash' in tags)
4803+ self.assertFalse('apport-collected' in tags)
4804+
4805+ # updating with a useful stack trace removes core dump
4806+ r['StacktraceTop'] = 'read () from /lib/libc.6.so\nfoo (i=1) from /usr/lib/libfoo.so'
4807+ r['Stacktrace'] = 'long\ntrace'
4808+ r['ThreadStacktrace'] = 'thread\neven longer\ntrace'
4809+ self.crashdb.update_traces(self.get_segv_report(), r, 'good retrace!')
4810+ r = self.crashdb.download(self.get_segv_report())
4811+ self.assertFalse('CoreDump' in r)
4812+ self.assertTrue('Dependencies' in r)
4813+ self.assertTrue('Disassembly' in r)
4814+ self.assertTrue('Registers' in r)
4815+ self.assertTrue('Stacktrace' in r)
4816+ self.assertTrue('ThreadStacktrace' in r)
4817+ self.assertFalse('FooBar' in r)
4818+
4819+ # as previous title had standard form, the top function gets
4820+ # updated
4821+ self.assertEqual(r['Title'], 'crash crashed with SIGSEGV in read()')
4822+
4823+ # respects title amendments
4824+ bug = self.crashdb.launchpad.bugs[self.get_segv_report()]
4825+ bug.title = 'crash crashed with SIGSEGV in f() on exit'
4826+ try:
4827+ bug.lp_save()
4828+ except HTTPError:
4829+ pass # LP#336866 workaround
4830+ r['StacktraceTop'] = 'read () from /lib/libc.6.so\nfoo (i=1) from /usr/lib/libfoo.so'
4831+ self.crashdb.update_traces(self.get_segv_report(), r, 'good retrace with title amendment')
4832+ r = self.crashdb.download(self.get_segv_report())
4833+ self.assertEqual(r['Title'], 'crash crashed with SIGSEGV in read() on exit')
4834+
4835+ # does not destroy custom titles
4836+ bug = self.crashdb.launchpad.bugs[self.get_segv_report()]
4837+ bug.title = 'crash is crashy'
4838+ try:
4839+ bug.lp_save()
4840+ except HTTPError:
4841+ pass # LP#336866 workaround
4842+
4843+ r['StacktraceTop'] = 'read () from /lib/libc.6.so\nfoo (i=1) from /usr/lib/libfoo.so'
4844+ self.crashdb.update_traces(self.get_segv_report(), r, 'good retrace with custom title')
4845+ r = self.crashdb.download(self.get_segv_report())
4846+ self.assertEqual(r['Title'], 'crash is crashy')
4847+
4848+ # test various situations which caused crashes
4849+ r['Stacktrace'] = '' # empty file
4850+ r['ThreadStacktrace'] = '"]\xb6"\n' # not interpretable as UTF-8, LP #353805
4851+ r['StacktraceSource'] = 'a\nb\nc\nd\ne\n\xff\xff\xff\n\f'
4852+ self.crashdb.update_traces(self.get_segv_report(), r, 'tests')
4853+
4854+ def test_get_comment_url(self):
4855+ '''get_comment_url() for non-ASCII titles'''
4856+
4857+ # UTF-8 bytestring, works in both python 2.7 and 3
4858+ title = b'1\xc3\xa4\xe2\x99\xa52'
4859+
4860+ # distro, UTF-8 bytestring
4861+ r = apport.Report('Bug')
4862+ r['Title'] = title
4863+ url = self.crashdb.get_comment_url(r, 42)
4864+ self.assertTrue(url.endswith('/ubuntu/+filebug/42?field.title=1%C3%A4%E2%99%A52'))
4865+
4866+ # distro, unicode
4867+ r['Title'] = title.decode('UTF-8')
4868+ url = self.crashdb.get_comment_url(r, 42)
4869+ self.assertTrue(url.endswith('/ubuntu/+filebug/42?field.title=1%C3%A4%E2%99%A52'))
4870+
4871+ # package, unicode
4872+ r['SourcePackage'] = 'coreutils'
4873+ url = self.crashdb.get_comment_url(r, 42)
4874+ self.assertTrue(url.endswith('/ubuntu/+source/coreutils/+filebug/42?field.title=1%C3%A4%E2%99%A52'))
4875+
4876+ def test_update_description(self):
4877+ '''update() with changing description'''
4878+
4879+ bug_target = self.crashdb.lp_distro.getSourcePackage(name='bash')
4880+ bug = self.crashdb.launchpad.bugs.createBug(
4881+ description='test description for test bug.',
4882+ target=bug_target,
4883+ title='testbug')
4884+ id = bug.id
4885+ self.assertTrue(id > 0)
4886+ sys.stderr.write('(https://%s/bugs/%i) ' % (self.hostname, id))
4887+
4888+ r = apport.Report('Bug')
4889+
4890+ r['OneLiner'] = b'bogus\xe2\x86\x92'.decode('UTF-8')
4891+ r['StacktraceTop'] = 'f()\ng()\nh(1)'
4892+ r['ShortGoo'] = 'lineone\nlinetwo'
4893+ r['DpkgTerminalLog'] = 'one\ntwo\nthree\nfour\nfive\nsix'
4894+ r['VarLogDistupgradeBinGoo'] = b'\x01' * 1024
4895+
4896+ self.crashdb.update(id, r, 'NotMe', change_description=True)
4897+
4898+ r = self.crashdb.download(id)
4899+
4900+ self.assertEqual(r['OneLiner'], b'bogus\xe2\x86\x92'.decode('UTF-8'))
4901+ self.assertEqual(r['ShortGoo'], 'lineone\nlinetwo')
4902+ self.assertEqual(r['DpkgTerminalLog'], 'one\ntwo\nthree\nfour\nfive\nsix')
4903+ self.assertEqual(r['VarLogDistupgradeBinGoo'], b'\x01' * 1024)
4904+
4905+ self.assertEqual(self.crashdb.launchpad.bugs[id].tags,
4906+ ['apport-collected'])
4907+
4908+ def test_update_comment(self):
4909+ '''update() with appending comment'''
4910+
4911+ bug_target = self.crashdb.lp_distro.getSourcePackage(name='bash')
4912+ # we need to fake an apport description separator here, since we
4913+ # want to be lazy and use download() for checking the result
4914+ bug = self.crashdb.launchpad.bugs.createBug(
4915+ description='Pr0blem\n\n--- \nProblemType: Bug',
4916+ target=bug_target,
4917+ title='testbug')
4918+ id = bug.id
4919+ self.assertTrue(id > 0)
4920+ sys.stderr.write('(https://%s/bugs/%i) ' % (self.hostname, id))
4921+
4922+ r = apport.Report('Bug')
4923+
4924+ r['OneLiner'] = 'bogus→'
4925+ r['StacktraceTop'] = 'f()\ng()\nh(1)'
4926+ r['ShortGoo'] = 'lineone\nlinetwo'
4927+ r['DpkgTerminalLog'] = 'one\ntwo\nthree\nfour\nfive\nsix'
4928+ r['VarLogDistupgradeBinGoo'] = '\x01' * 1024
4929+
4930+ self.crashdb.update(id, r, 'meow', change_description=False)
4931+
4932+ r = self.crashdb.download(id)
4933+
4934+ self.assertFalse('OneLiner' in r)
4935+ self.assertFalse('ShortGoo' in r)
4936+ self.assertEqual(r['ProblemType'], 'Bug')
4937+ self.assertEqual(r['DpkgTerminalLog'], 'one\ntwo\nthree\nfour\nfive\nsix')
4938+ self.assertEqual(r['VarLogDistupgradeBinGoo'], '\x01' * 1024)
4939+
4940+ self.assertEqual(self.crashdb.launchpad.bugs[id].tags,
4941+ ['apport-collected'])
4942+
4943+ def test_update_filter(self):
4944+ '''update() with a key filter'''
4945+
4946+ bug_target = self.crashdb.lp_distro.getSourcePackage(name='bash')
4947+ bug = self.crashdb.launchpad.bugs.createBug(
4948+ description='test description for test bug',
4949+ target=bug_target,
4950+ title='testbug')
4951+ id = bug.id
4952+ self.assertTrue(id > 0)
4953+ sys.stderr.write('(https://%s/bugs/%i) ' % (self.hostname, id))
4954+
4955+ r = apport.Report('Bug')
4956+
4957+ r['OneLiner'] = 'bogus→'
4958+ r['StacktraceTop'] = 'f()\ng()\nh(1)'
4959+ r['ShortGoo'] = 'lineone\nlinetwo'
4960+ r['DpkgTerminalLog'] = 'one\ntwo\nthree\nfour\nfive\nsix'
4961+ r['VarLogDistupgradeBinGoo'] = '\x01' * 1024
4962+
4963+ self.crashdb.update(id, r, 'NotMe', change_description=True,
4964+ key_filter=['ProblemType', 'ShortGoo', 'DpkgTerminalLog'])
4965+
4966+ r = self.crashdb.download(id)
4967+
4968+ self.assertFalse('OneLiner' in r)
4969+ self.assertEqual(r['ShortGoo'], 'lineone\nlinetwo')
4970+ self.assertEqual(r['ProblemType'], 'Bug')
4971+ self.assertEqual(r['DpkgTerminalLog'], 'one\ntwo\nthree\nfour\nfive\nsix')
4972+ self.assertFalse('VarLogDistupgradeBinGoo' in r)
4973+
4974+ self.assertEqual(self.crashdb.launchpad.bugs[id].tags, [])
4975+
4976+ def test_get_distro_release(self):
4977+ '''get_distro_release()'''
4978+
4979+ self.assertEqual(self.crashdb.get_distro_release(self.get_segv_report()),
4980+ self.ref_report['DistroRelease'])
4981+
4982+ def test_get_affected_packages(self):
4983+ '''get_affected_packages()'''
4984+
4985+ self.assertEqual(self.crashdb.get_affected_packages(self.get_segv_report()),
4986+ [self.ref_report['SourcePackage']])
4987+
4988+ def test_is_reporter(self):
4989+ '''is_reporter()'''
4990+
4991+ self.assertTrue(self.crashdb.is_reporter(self.get_segv_report()))
4992+ self.assertFalse(self.crashdb.is_reporter(1))
4993+
4994+ def test_can_update(self):
4995+ '''can_update()'''
4996+
4997+ self.assertTrue(self.crashdb.can_update(self.get_segv_report()))
4998+ self.assertFalse(self.crashdb.can_update(1))
4999+
5000+ def test_duplicates(self):
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches