← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~ev/apport/1163453 into lp:apport

 

Evan Dandrea has proposed merging lp:~ev/apport/1163453 into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)
Related bugs:
  Bug #1163453 in apport (Ubuntu): "signal crashes fail when the user has been removed prior to crash"
  https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1163453

For more details, see:
https://code.launchpad.net/~ev/apport/1163453/+merge/156637

This branch fixes bug 1163453. I would've built the test into the signal crashes test cases, but I couldn't think of a good way to mock os.getuid() across process boundaries.
-- 
https://code.launchpad.net/~ev/apport/1163453/+merge/156637
Your team Apport upstream developers is requested to review the proposed merge of lp:~ev/apport/1163453 into lp:apport.
=== modified file 'NEWS'
--- NEWS	2013-03-27 07:56:05 +0000
+++ NEWS	2013-04-02 17:00:55 +0000
@@ -10,6 +10,8 @@
    invalid. (LP: #1154896) 
  * data/gcc_ice_hook: Fix crash with source files that have non-UTF8 data.
    (LP: #1045283)
+ * apport/report.py: Handle the case where the user has been removed from the
+   system, but one of its still-running binaries crashes (LP: #1163453).
 
 2.9.2 (2013-03-19):
 -------------------

=== modified file 'apport/report.py'
--- apport/report.py	2013-03-12 11:31:40 +0000
+++ apport/report.py	2013-04-02 17:00:55 +0000
@@ -952,7 +952,12 @@
         except OSError:
             pass
 
-        dom = self._get_ignore_dom()
+        try:
+            dom = self._get_ignore_dom()
+        except (ValueError, KeyError):
+            apport.error('Could not get ignore file:')
+            traceback.print_exc()
+            return False
 
         try:
             cur_mtime = int(os.stat(self['ExecutablePath']).st_mtime)

=== modified file 'test/test_report.py'
--- test/test_report.py	2013-01-04 12:48:54 +0000
+++ test/test_report.py	2013-04-02 17:00:55 +0000
@@ -2115,6 +2115,17 @@
 #7  0x000000000041d703 in _start ()
 '''
         self.assertEqual(pr.crash_signature_addresses(), None)
+    def test_missing_uid(self):
+        '''check_ignored() works when the user for the running process has been
+        removed.'''
+        orig_getuid = os.getuid
+        os.getuid = lambda: 123456789
+        try:
+            pr = apport.report.Report()
+            pr['ExecutablePath'] = '/bin/bash'
+            pr.check_ignored()
+        finally:
+            os.getuid = orig_getuid
 
 if __name__ == '__main__':
     unittest.main()