Rev 6513: (jameinel) Merge bzr-2.4 to bring in bugfixes for bug #830947 and bug in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/
Patch Queue Manager
pqm at pqm.ubuntu.com
Thu May 23 10:00:08 UTC 2013
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/
------------------------------------------------------------
revno: 6513 [merge]
revision-id: pqm at pqm.ubuntu.com-20130523100008-23bj7tfh34p6wqj0
parent: pqm at pqm.ubuntu.com-20130523092309-qdi5fuhfpwbb3hjo
parent: john at arbash-meinel.com-20130523092710-pw16hzoeyxwx33zv
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.5
timestamp: Thu 2013-05-23 10:00:08 +0000
message:
(jameinel) Merge bzr-2.4 to bring in bugfixes for bug #830947 and bug
#1075108. (John A Meinel)
modified:
bzrlib/dirstate.py dirstate.py-20060728012006-d6mvoihjb3je9peu-1
bzrlib/osutils.py osutils.py-20050309040759-eeaff12fbf77ac86
bzrlib/tests/test_osutils.py test_osutils.py-20051201224856-e48ee24c12182989
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2012-01-05 11:16:45 +0000
+++ b/bzrlib/dirstate.py 2013-05-23 09:27:10 +0000
@@ -2566,13 +2566,6 @@
self.update_minimal(('', '', new_id), 'd',
path_utf8='', packed_stat=entry[1][0][4])
self._mark_modified()
- # XXX: This was added by Ian, we need to make sure there
- # are tests for it, because it isn't in bzr.dev TRUNK
- # It looks like the only place it is called is in setting the root
- # id of the tree. So probably we never had an _id_index when we
- # don't even have a root yet.
- if self._id_index is not None:
- self._add_to_id_index(self._id_index, entry[0])
def set_parent_trees(self, trees, ghosts):
"""Set the parent trees for the dirstate.
@@ -3285,10 +3278,20 @@
if self._id_index is not None:
for file_id, entry_keys in self._id_index.iteritems():
for entry_key in entry_keys:
+ # Check that the entry in the map is pointing to the same
+ # file_id
if entry_key[2] != file_id:
raise AssertionError(
'file_id %r did not match entry key %s'
% (file_id, entry_key))
+ # And that from this entry key, we can look up the original
+ # record
+ block_index, present = self._find_block_index_from_key(entry_key)
+ if not present:
+ raise AssertionError('missing block for entry key: %r', entry_key)
+ entry_index, present = self._find_entry_index(entry_key, self._dirblocks[block_index][1])
+ if not present:
+ raise AssertionError('missing entry for key: %r', entry_key)
if len(entry_keys) != len(set(entry_keys)):
raise AssertionError(
'id_index contained non-unique data for %s'
=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py 2012-09-11 08:39:14 +0000
+++ b/bzrlib/osutils.py 2013-05-23 09:27:10 +0000
@@ -2532,6 +2532,10 @@
else:
is_local_pid_dead = _posix_is_local_pid_dead
+_maybe_ignored = ['EAGAIN', 'EINTR', 'ENOTSUP', 'EOPNOTSUPP', 'EACCES']
+_fdatasync_ignored = [getattr(errno, name) for name in _maybe_ignored
+ if getattr(errno, name, None) is not None]
+
def fdatasync(fileno):
"""Flush file contents to disk if possible.
@@ -2541,7 +2545,16 @@
"""
fn = getattr(os, 'fdatasync', getattr(os, 'fsync', None))
if fn is not None:
- fn(fileno)
+ try:
+ fn(fileno)
+ except IOError, e:
+ # See bug #1075108, on some platforms fdatasync exists, but can
+ # raise ENOTSUP. However, we are calling fdatasync to be helpful
+ # 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):
=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py 2012-09-11 08:39:14 +0000
+++ b/bzrlib/tests/test_osutils.py 2013-05-23 09:27:10 +0000
@@ -23,6 +23,7 @@
import select
import socket
import sys
+import tempfile
import time
from bzrlib import (
@@ -427,6 +428,49 @@
self.assertTrue(-eighteen_hours < offset < eighteen_hours)
+class TestFdatasync(tests.TestCaseInTempDir):
+
+ def do_fdatasync(self):
+ f = tempfile.NamedTemporaryFile()
+ osutils.fdatasync(f.fileno())
+ f.close()
+
+ @staticmethod
+ def raise_eopnotsupp(*args, **kwargs):
+ raise IOError(errno.EOPNOTSUPP, os.strerror(errno.EOPNOTSUPP))
+
+ @staticmethod
+ def raise_enotsup(*args, **kwargs):
+ raise IOError(errno.ENOTSUP, os.strerror(errno.ENOTSUP))
+
+ def test_fdatasync_handles_system_function(self):
+ self.overrideAttr(os, "fdatasync")
+ self.do_fdatasync()
+
+ def test_fdatasync_handles_no_fdatasync_no_fsync(self):
+ self.overrideAttr(os, "fdatasync")
+ self.overrideAttr(os, "fsync")
+ self.do_fdatasync()
+
+ def test_fdatasync_handles_no_EOPNOTSUPP(self):
+ self.overrideAttr(errno, "EOPNOTSUPP")
+ self.do_fdatasync()
+
+ def test_fdatasync_catches_ENOTSUP(self):
+ enotsup = getattr(errno, "ENOTSUP", None)
+ if enotsup is None:
+ raise tests.TestNotApplicable("No ENOTSUP on this platform")
+ self.overrideAttr(os, "fdatasync", self.raise_enotsup)
+ self.do_fdatasync()
+
+ def test_fdatasync_catches_EOPNOTSUPP(self):
+ enotsup = getattr(errno, "EOPNOTSUPP", None)
+ if enotsup is None:
+ raise tests.TestNotApplicable("No EOPNOTSUPP on this platform")
+ self.overrideAttr(os, "fdatasync", self.raise_eopnotsupp)
+ self.do_fdatasync()
+
+
class TestLinks(tests.TestCaseInTempDir):
def test_dereference_path(self):
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2013-05-19 14:29:37 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2013-05-23 09:27:10 +0000
@@ -35,6 +35,10 @@
* Cope with Unix filesystems, such as smbfs, where chmod gives 'permission
denied'. (Martin Pool, #606537)
+* Fix a traceback when trying to checkout a tree that also has an entry
+ with file-id `TREE_ROOT` somewhere other than at the root directory.
+ (John Arbash Meinel, #830947)
+
* When the ``limbo`` or ``pending-deletion`` directories exist, typically
because of an interrupted tree update, but are empty, bzr no longer
errors out, because there is nothing for the user to clean up. Also,
@@ -55,6 +59,10 @@
* Prevent a traceback being printed to stderr when logging has problems and
accept utf-8 byte string without breaking. (Martin Packman, #714449)
+* Some filesystems give ``EOPNOTSUPP`` when trying to call ``fdatasync``.
+ This shouldn't be treated as a fatal error.
+ (John Arbash Meinel, #1075108)
+
* Use ``encoding_type='exact'`` for ``bzr testament`` so that on Windows
the sha hash of the long testament matches the sha hash in the short
form. (John Arbash Meinel, #1010339)
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt 2012-09-07 13:15:02 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt 2013-05-23 09:27:10 +0000
@@ -35,6 +35,10 @@
* ``bzr config`` properly handles aliases and references in the
``--directory`` parameter (Vincent Ladeuil, Wouter van Heyst, #947049)
+* Fix a traceback when trying to checkout a tree that also has an entry
+ with file-id `TREE_ROOT` somewhere other than at the root directory.
+ (John Arbash Meinel, #830947)
+
* Lightweight checkouts of remote repositories had a bug with how they
extracted texts from the repository. (Just an ordering constraint on how
they consumed the stream.) (John Arbash Meinel, #1046284)
@@ -48,6 +52,10 @@
* Revert use of --no-tty when gpg signing commits. (Jelmer Vernooij, #1014570)
+* Some filesystems give ``EOPNOTSUPP`` when trying to call ``fdatasync``.
+ This shouldn't be treated as a fatal error.
+ (John Arbash Meinel, #1075108)
+
* Some small bug fixes wrt lightweight checkouts and remote repositories.
A test permutation was added that runs all working tree tests against a
lightweight checkout. (John Arbash Meinel, #1046697)
More information about the bazaar-commits
mailing list