← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~brian-murray/apport/whoopsie-upload-more into lp:apport

 

Brian Murray has proposed merging lp:~brian-murray/apport/whoopsie-upload-more into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)

For more details, see:
https://code.launchpad.net/~brian-murray/apport/whoopsie-upload-more/+merge/365252

For reasons unknown to me whoopsie-upload-all as it is currently written will quit if the add_gdb_info() call fails. This is different than the behavior in apport/ui.py which will pass on a failure because "we'll get stack traces on retracing". So this change modifies how add_gdb_info exits so that whoopsie-upload-all will proceed with gathering crash information and creating the .upload file. This will in turn end up fixing bug 1820132.

I wonder if there is a better way to do this though so all feedback is welcome!
-- 
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/whoopsie-upload-more into lp:apport.
=== modified file 'apport/report.py'
--- apport/report.py	2019-03-15 21:53:40 +0000
+++ apport/report.py	2019-03-28 23:06:05 +0000
@@ -718,6 +718,8 @@
                        'GLibAssertionMessage': 'print __glib_assert_msg',
                        'NihAssertionMessage': 'print (char*) __nih_abort_msg'}
         gdb_cmd, environ = self.gdb_command(rootdir, gdb_sandbox)
+        if not gdb_cmd:
+            raise OSError("gdb executable not found.")
 
         # limit maximum backtrace depth (to avoid looped stacks)
         gdb_cmd += ['--batch', '--ex', 'set backtrace limit 2000']
@@ -742,6 +744,8 @@
             reason = 'Invalid core dump: ' + warnings.strip()
             self['UnreportableReason'] = reason
             raise IOError(reason)
+        elif out.split('\n')[0].endswith('No such file or directory.'):
+            raise OSError("Crash's executable not found.")
 
         # split the output into the various fields
         part_re = re.compile(r'^\$\d+\s*=\s*-99$', re.MULTILINE)
@@ -1544,8 +1548,7 @@
                            if gdb_sandbox else None)
         gdb_path = _which_extrapath('gdb', gdb_sandbox_bin)
         if not gdb_path:
-            apport.fatal('gdb does not exist in the %ssandbox nor on the host'
-                         % ('gdb ' if not same_arch else ''))
+            return '', ''
         command = [gdb_path]
         environ = None
 
@@ -1587,7 +1590,6 @@
                             gdb_sandbox]
             executable = sandbox + '/' + executable
 
-        assert os.path.exists(executable)
         command += ['--ex', 'file "%s"' % executable]
 
         if 'CoreDump' in self:

=== modified file 'data/whoopsie-upload-all'
--- data/whoopsie-upload-all	2016-12-10 11:28:27 +0000
+++ data/whoopsie-upload-all	2019-03-28 23:06:05 +0000
@@ -78,10 +78,14 @@
         try:
             r.add_gdb_info()
         except (IOError, EOFError, OSError) as e:
-            sys.stderr.write('ERROR: processing %s: %s\n' % (report, str(e)))
-            if os.path.exists(report):
-                os.unlink(report)
-            return None
+            # the crash file won't have a Stacktrace etc but apport-retrace
+            # could still process it
+            if str(e) not in ("Crash's executable not found.",
+                              "gdb executable not found."):
+                sys.stderr.write('ERROR: processing %s: %s\n' % (report, str(e)))
+                if os.path.exists(report):
+                    os.unlink(report)
+                return None
 
         # write updated report
         with open(report, 'ab') as f: