← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~mwhudson/apport/lp-1854237 into lp:apport

 

Michael Hudson-Doyle has proposed merging lp:~mwhudson/apport/lp-1854237 into lp:apport.

Commit message:
Fix some autopkgtest failures.

Requested reviews:
  Apport upstream developers (apport-hackers)

For more details, see:
https://code.launchpad.net/~mwhudson/apport/lp-1854237/+merge/376093

This fixes test_core_dump_packaged, test_core_dump_unpackaged and test_get_logind_session. There are some other failures as well but possibly those should just be deleted (comments on the linked bug please).
-- 
Your team Apport upstream developers is requested to review the proposed merge of lp:~mwhudson/apport/lp-1854237 into lp:apport.
=== modified file 'data/apport'
--- data/apport	2019-04-01 21:59:51 +0000
+++ data/apport	2019-11-28 01:57:02 +0000
@@ -199,7 +199,7 @@
         if limit > 0 and core_size > limit:
             error_log('aborting core dump writing, size %i exceeds current limit' % core_size)
             os.close(core_file)
-            os.unlink(core_path)
+            os.unlink(core_path, dir_fd=cwd)
             return
         error_log('writing core dump %s of size %i' % (core_path, core_size))
         os.write(core_file, r['CoreDump'])
@@ -215,17 +215,16 @@
             if limit > 0 and written > limit:
                 error_log('aborting core dump writing, size exceeds current limit %i' % limit)
                 os.close(core_file)
-                os.unlink(core_path)
+                os.unlink(core_path, dir_fd=cwd)
                 return
             if os.write(core_file, block) != size:
                 error_log('aborting core dump writing, could not write')
                 os.close(core_file)
-                os.unlink(core_path)
+                os.unlink(core_path, dir_fd=cwd)
                 return
             block = os.read(0, 1048576)
 
     os.close(core_file)
-    return core_path
 
 
 def usable_ram():

=== modified file 'test/test_report.py'
--- test/test_report.py	2019-05-17 17:43:17 +0000
+++ test/test_report.py	2019-11-28 01:57:02 +0000
@@ -2274,7 +2274,9 @@
         self.assertEqual(expected, pr.crash_signature())
 
     def test_get_logind_session(self):
-        ret = apport.Report.get_logind_session(os.getpid())
+        proc_pid_fd = os.open('/proc/%s' % os.getpid(), os.O_RDONLY | os.O_PATH | os.O_DIRECTORY)
+        self.addCleanup(os.close, proc_pid_fd)
+        ret = apport.Report.get_logind_session(proc_pid_fd)
         if ret is None:
             # ensure that we don't run under logind, and thus the None is
             # justified


Follow ups