Rev 6075: only squelch known errors per vila. in http://bazaar.launchpad.net/~jameinel/bzr/2.4-fdatasync-ENOTSUP-1075108

John Arbash Meinel john at arbash-meinel.com
Thu May 23 08:10:58 UTC 2013


At http://bazaar.launchpad.net/~jameinel/bzr/2.4-fdatasync-ENOTSUP-1075108

------------------------------------------------------------
revno: 6075
revision-id: john at arbash-meinel.com-20130523081058-hceputwy9u0tckjg
parent: john at arbash-meinel.com-20121105120539-ri8f1r6jpzt7oz1o
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-fdatasync-ENOTSUP-1075108
timestamp: Thu 2013-05-23 09:10:58 +0100
message:
  only squelch known errors per vila.
-------------- next part --------------
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2012-11-05 12:05:39 +0000
+++ b/bzrlib/osutils.py	2013-05-23 08:10:58 +0000
@@ -2522,6 +2522,9 @@
 else:
     is_local_pid_dead = _posix_is_local_pid_dead
 
+_fdatasync_ignored = [getattr(errno, name)
+                      for name in ['EAGAIN', 'EINTR', 'ENOTSUP', 'EACCES']
+                      if getattr(errno, name, None) is not None]
 
 def fdatasync(fileno):
     """Flush file contents to disk if possible.
@@ -2539,6 +2542,8 @@
             # and reduce the chance of corruption-on-powerloss situations. It
             # is not a mandatory call, so it is ok to suppress failures.
             trace.mutter("ignoring error calling fdatasync: %s" % (e,))
+            if getattr(e, 'errno', None) not in _fdatasync_ignored:
+                raise
 
 
 def ensure_empty_directory_exists(path, exception_class):



More information about the bazaar-commits mailing list