apport-hackers team mailing list archive
-
apport-hackers team
-
Mailing list archive
-
Message #00114
[Merge] lp:~ev/apport/fsync-upstart-crashes into lp:apport
Evan Dandrea has proposed merging lp:~ev/apport/fsync-upstart-crashes into lp:apport.
Requested reviews:
James Hunt (jamesodhunt)
Apport upstream developers (apport-hackers)
For more details, see:
https://code.launchpad.net/~ev/apport/fsync-upstart-crashes/+merge/135134
As discussed in the "Apport/Whoopsie and Upstart" email, we should fsync crashes of upstart.
--
https://code.launchpad.net/~ev/apport/fsync-upstart-crashes/+merge/135134
Your team Apport upstream developers is requested to review the proposed merge of lp:~ev/apport/fsync-upstart-crashes into lp:apport.
=== modified file 'data/apport'
--- data/apport 2012-07-12 15:11:48 +0000
+++ data/apport 2012-11-20 12:16:25 +0000
@@ -422,6 +422,17 @@
try:
info.write(reportfile)
if reportfile != sys.stderr:
+ # Ensure that the file gets written to disk in the event of an
+ # Upstart crash.
+ if info.get('ExectuablePath', '') == '/sbin/init':
+ reportfile.flush()
+ os.fsync(reportfile.fileno())
+ parent_directory = os.path.dirname(report)
+ try:
+ fd = os.open(parent_directory, os.O_RDONLY)
+ os.fsync(fd)
+ finally:
+ os.close(fd)
reportfile.close()
except IOError:
if reportfile != sys.stderr:
Follow ups