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