← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~brian-murray/apport/bug-1500541 into lp:apport


Brian Murray has proposed merging lp:~brian-murray/apport/bug-1500541 into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)
Related bugs:
  Bug #1500541 in apport (Ubuntu): "apport-retrace crashed with IOError in __main__: [Errno 13] Permission denied: '_usr_bin_Xorg.0.crash'"

For more details, see:

When we initially load the report we only open it for reading, later after retracing we open it for writing and if we can't write to the report apport crashes. This is after a fair bit of work, so it'd be better to write to a new file rather than lose that work.
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/bug-1500541 into lp:apport.
=== modified file 'bin/apport-retrace'
--- bin/apport-retrace	2015-09-24 12:19:28 +0000
+++ bin/apport-retrace	2016-01-06 18:06:54 +0000
@@ -402,7 +402,12 @@
         if options.output is None:
-            out = open(options.report, 'wb')
+            try:
+                out = open(options.report, 'wb')
+            except PermissionError:
+                apport.error("Cannot write to %s, writing to %s.retraced instead." %
+                             (options.report, options.report))
+                out = open('%s.out' % options.report, 'wb')
         elif options.output == '-':
             if sys.version[0] < '3':
                 out = sys.stdout