Merge lp:~james-page/ubuntu/raring/apport/cloud-archive into lp:ubuntu/raring/apport

Proposed by James Page
Status: Superseded
Proposed branch: lp:~james-page/ubuntu/raring/apport/cloud-archive
Merge into: lp:ubuntu/raring/apport
Diff against target: 140367 lines (+139168/-0) (has conflicts)
226 files modified
.bzr-builddeb/default.conf (+2/-0)
.bzrignore (+9/-0)
AUTHORS (+34/-0)
COPYING (+339/-0)
NEWS (+1824/-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 (+900/-0)
apport/packaging.py (+237/-0)
apport/report.py (+1530/-0)
apport/sandboxutils.py (+212/-0)
apport/ui.py (+1560/-0)
apport_python_hook.py (+197/-0)
backends/packaging-apt-dpkg.py (+927/-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 (+461/-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/cloud_archive.py (+21/-0)
data/general-hooks/generic.py (+94/-0)
data/general-hooks/parse_segv.py (+376/-0)
data/general-hooks/ubuntu-gnome.py (+31/-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 (+61/-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 (+138/-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 (+7471/-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 (+43/-0)
etc/bash_completion.d/apport_completion (+268/-0)
etc/cron.daily/apport (+5/-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 (+1028/-0)
po/af.po (+1028/-0)
po/am.po (+1028/-0)
po/an.po (+1028/-0)
po/apport.pot (+843/-0)
po/ar.po (+1181/-0)
po/ast.po (+1235/-0)
po/be.po (+1259/-0)
po/bg.po (+1180/-0)
po/bn.po (+1046/-0)
po/br.po (+1028/-0)
po/bs.po (+1061/-0)
po/ca.po (+1299/-0)
po/ca@valencia.po (+1088/-0)
po/cs.po (+1241/-0)
po/cv.po (+1028/-0)
po/da.po (+1230/-0)
po/de.po (+1349/-0)
po/el.po (+1304/-0)
po/en_AU.po (+1292/-0)
po/en_CA.po (+1269/-0)
po/en_GB.po (+1292/-0)
po/eo.po (+1241/-0)
po/es.po (+1324/-0)
po/et.po (+1215/-0)
po/eu.po (+1213/-0)
po/fa.po (+1028/-0)
po/fi.po (+1274/-0)
po/fr.po (+1279/-0)
po/ga.po (+1028/-0)
po/gd.po (+1028/-0)
po/gl.po (+1321/-0)
po/gu.po (+1072/-0)
po/he.po (+1190/-0)
po/hi.po (+1069/-0)
po/hr.po (+1185/-0)
po/hu.po (+1298/-0)
po/hy.po (+1028/-0)
po/id.po (+1217/-0)
po/is.po (+1163/-0)
po/it.po (+1292/-0)
po/ja.po (+1170/-0)
po/kab.po (+1028/-0)
po/kk.po (+1028/-0)
po/km.po (+1146/-0)
po/kn.po (+1096/-0)
po/ko.po (+1150/-0)
po/ku.po (+1116/-0)
po/lo.po (+1028/-0)
po/lt.po (+1283/-0)
po/lv.po (+1047/-0)
po/mk.po (+1028/-0)
po/ml.po (+1028/-0)
po/ms.po (+1182/-0)
po/my.po (+1043/-0)
po/nb.po (+1207/-0)
po/nds.po (+1066/-0)
po/ne.po (+1040/-0)
po/nl.po (+1243/-0)
po/oc.po (+1312/-0)
po/pl.po (+1297/-0)
po/pt.po (+1218/-0)
po/pt_BR.po (+1316/-0)
po/ro.po (+1243/-0)
po/ru.po (+1264/-0)
po/sc.po (+1028/-0)
po/se.po (+1028/-0)
po/shn.po (+1028/-0)
po/si.po (+1032/-0)
po/sk.po (+1196/-0)
po/sl.po (+1266/-0)
po/sq.po (+1233/-0)
po/sr.po (+1310/-0)
po/sv.po (+1292/-0)
po/ta.po (+1062/-0)
po/te.po (+1038/-0)
po/th.po (+1067/-0)
po/tr.po (+1269/-0)
po/ug.po (+1179/-0)
po/uk.po (+1207/-0)
po/uz.po (+1028/-0)
po/vi.po (+1196/-0)
po/zh_CN.po (+1153/-0)
po/zh_HK.po (+1032/-0)
po/zh_TW.po (+1167/-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 (+327/-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 (+639/-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:~james-page/ubuntu/raring/apport/cloud-archive
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+158375@code.launchpad.net

This proposal has been superseded by a proposal from 2013-04-11.

To post a comment you must log in.
2182. By James Page

Move crashdb configuration for cloud-archive into cloud_archive hook

2183. By James Page

Use apport.packaging to determine version and origin of cloud_archive packages

2184. By James Page

Update changelog to reflect changes

Unmerged revisions

2184. By James Page

Update changelog to reflect changes

2183. By James Page

Use apport.packaging to determine version and origin of cloud_archive packages

2182. By James Page

Move crashdb configuration for cloud-archive into cloud_archive hook

2181. By James Page

etc/apport/crashdb.conf,data/general-hooks/cloud_archive.py: Send
reports for packages from the Ubuntu Cloud Archive to the cloud-archive
project on Launchpad.

2180. By Martin Pitt

releasing version 2.9.2-0ubuntu6

2179. By Martin Pitt

etc/apport/crashdb.conf: Disable Launchpad crash/kernel reports for the
raring release. Only report to http://errors.ubuntu.com from now on.

2178. By Martin Pitt

releasing version 2.9.2-0ubuntu5

2177. By Martin Pitt

* Merge from trunk:
  - data/gcc_ice_hook: Fix crash with source files that have non-UTF8 data.
    (LP: #1045283)

2176. By Martin Pitt

data/package-hooks/source_ubiquity.py: Fix crash on non-UTF-8 data in log
files.

2175. By Martin Pitt

releasing version 2.9.2-0ubuntu4

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

Subscribers

People subscribed via source and target branches

to all changes: