Merge lp:~jameinel/bzr/2.5-merges-2.4 into lp:bzr/2.5

Proposed by John A Meinel
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 6513
Proposed branch: lp:~jameinel/bzr/2.5-merges-2.4
Merge into: lp:bzr/2.5
Diff against target: 185 lines (+84/-8)
5 files modified
bzrlib/dirstate.py (+10/-7)
bzrlib/osutils.py (+14/-1)
bzrlib/tests/test_osutils.py (+44/-0)
doc/en/release-notes/bzr-2.4.txt (+8/-0)
doc/en/release-notes/bzr-2.5.txt (+8/-0)
To merge this branch: bzr merge lp:~jameinel/bzr/2.5-merges-2.4
Reviewer Review Type Date Requested Status
Richard Wilbur Approve
Review via email: mp+165326@code.launchpad.net

Commit message

Merge bzr-2.4 to bring in bugfixes for bug #830947 and bug #1075108.

Description of the change

This just brings in the next round of changes from the 2.4 branch.

To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

sent to pqm by email

Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Thanks for bringing the good stuff forward to 2.5! (I already approved this earlier on 2.4;>)
+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/dirstate.py'
2--- bzrlib/dirstate.py 2012-01-05 11:16:45 +0000
3+++ bzrlib/dirstate.py 2013-05-23 09:32:44 +0000
4@@ -2566,13 +2566,6 @@
5 self.update_minimal(('', '', new_id), 'd',
6 path_utf8='', packed_stat=entry[1][0][4])
7 self._mark_modified()
8- # XXX: This was added by Ian, we need to make sure there
9- # are tests for it, because it isn't in bzr.dev TRUNK
10- # It looks like the only place it is called is in setting the root
11- # id of the tree. So probably we never had an _id_index when we
12- # don't even have a root yet.
13- if self._id_index is not None:
14- self._add_to_id_index(self._id_index, entry[0])
15
16 def set_parent_trees(self, trees, ghosts):
17 """Set the parent trees for the dirstate.
18@@ -3285,10 +3278,20 @@
19 if self._id_index is not None:
20 for file_id, entry_keys in self._id_index.iteritems():
21 for entry_key in entry_keys:
22+ # Check that the entry in the map is pointing to the same
23+ # file_id
24 if entry_key[2] != file_id:
25 raise AssertionError(
26 'file_id %r did not match entry key %s'
27 % (file_id, entry_key))
28+ # And that from this entry key, we can look up the original
29+ # record
30+ block_index, present = self._find_block_index_from_key(entry_key)
31+ if not present:
32+ raise AssertionError('missing block for entry key: %r', entry_key)
33+ entry_index, present = self._find_entry_index(entry_key, self._dirblocks[block_index][1])
34+ if not present:
35+ raise AssertionError('missing entry for key: %r', entry_key)
36 if len(entry_keys) != len(set(entry_keys)):
37 raise AssertionError(
38 'id_index contained non-unique data for %s'
39
40=== modified file 'bzrlib/osutils.py'
41--- bzrlib/osutils.py 2012-09-11 08:39:14 +0000
42+++ bzrlib/osutils.py 2013-05-23 09:32:44 +0000
43@@ -2532,6 +2532,10 @@
44 else:
45 is_local_pid_dead = _posix_is_local_pid_dead
46
47+_maybe_ignored = ['EAGAIN', 'EINTR', 'ENOTSUP', 'EOPNOTSUPP', 'EACCES']
48+_fdatasync_ignored = [getattr(errno, name) for name in _maybe_ignored
49+ if getattr(errno, name, None) is not None]
50+
51
52 def fdatasync(fileno):
53 """Flush file contents to disk if possible.
54@@ -2541,7 +2545,16 @@
55 """
56 fn = getattr(os, 'fdatasync', getattr(os, 'fsync', None))
57 if fn is not None:
58- fn(fileno)
59+ try:
60+ fn(fileno)
61+ except IOError, e:
62+ # See bug #1075108, on some platforms fdatasync exists, but can
63+ # raise ENOTSUP. However, we are calling fdatasync to be helpful
64+ # and reduce the chance of corruption-on-powerloss situations. It
65+ # is not a mandatory call, so it is ok to suppress failures.
66+ trace.mutter("ignoring error calling fdatasync: %s" % (e,))
67+ if getattr(e, 'errno', None) not in _fdatasync_ignored:
68+ raise
69
70
71 def ensure_empty_directory_exists(path, exception_class):
72
73=== modified file 'bzrlib/tests/test_osutils.py'
74--- bzrlib/tests/test_osutils.py 2012-09-11 08:39:14 +0000
75+++ bzrlib/tests/test_osutils.py 2013-05-23 09:32:44 +0000
76@@ -23,6 +23,7 @@
77 import select
78 import socket
79 import sys
80+import tempfile
81 import time
82
83 from bzrlib import (
84@@ -427,6 +428,49 @@
85 self.assertTrue(-eighteen_hours < offset < eighteen_hours)
86
87
88+class TestFdatasync(tests.TestCaseInTempDir):
89+
90+ def do_fdatasync(self):
91+ f = tempfile.NamedTemporaryFile()
92+ osutils.fdatasync(f.fileno())
93+ f.close()
94+
95+ @staticmethod
96+ def raise_eopnotsupp(*args, **kwargs):
97+ raise IOError(errno.EOPNOTSUPP, os.strerror(errno.EOPNOTSUPP))
98+
99+ @staticmethod
100+ def raise_enotsup(*args, **kwargs):
101+ raise IOError(errno.ENOTSUP, os.strerror(errno.ENOTSUP))
102+
103+ def test_fdatasync_handles_system_function(self):
104+ self.overrideAttr(os, "fdatasync")
105+ self.do_fdatasync()
106+
107+ def test_fdatasync_handles_no_fdatasync_no_fsync(self):
108+ self.overrideAttr(os, "fdatasync")
109+ self.overrideAttr(os, "fsync")
110+ self.do_fdatasync()
111+
112+ def test_fdatasync_handles_no_EOPNOTSUPP(self):
113+ self.overrideAttr(errno, "EOPNOTSUPP")
114+ self.do_fdatasync()
115+
116+ def test_fdatasync_catches_ENOTSUP(self):
117+ enotsup = getattr(errno, "ENOTSUP", None)
118+ if enotsup is None:
119+ raise tests.TestNotApplicable("No ENOTSUP on this platform")
120+ self.overrideAttr(os, "fdatasync", self.raise_enotsup)
121+ self.do_fdatasync()
122+
123+ def test_fdatasync_catches_EOPNOTSUPP(self):
124+ enotsup = getattr(errno, "EOPNOTSUPP", None)
125+ if enotsup is None:
126+ raise tests.TestNotApplicable("No EOPNOTSUPP on this platform")
127+ self.overrideAttr(os, "fdatasync", self.raise_eopnotsupp)
128+ self.do_fdatasync()
129+
130+
131 class TestLinks(tests.TestCaseInTempDir):
132
133 def test_dereference_path(self):
134
135=== modified file 'doc/en/release-notes/bzr-2.4.txt'
136--- doc/en/release-notes/bzr-2.4.txt 2013-05-19 14:29:37 +0000
137+++ doc/en/release-notes/bzr-2.4.txt 2013-05-23 09:32:44 +0000
138@@ -35,6 +35,10 @@
139 * Cope with Unix filesystems, such as smbfs, where chmod gives 'permission
140 denied'. (Martin Pool, #606537)
141
142+* Fix a traceback when trying to checkout a tree that also has an entry
143+ with file-id `TREE_ROOT` somewhere other than at the root directory.
144+ (John Arbash Meinel, #830947)
145+
146 * When the ``limbo`` or ``pending-deletion`` directories exist, typically
147 because of an interrupted tree update, but are empty, bzr no longer
148 errors out, because there is nothing for the user to clean up. Also,
149@@ -55,6 +59,10 @@
150 * Prevent a traceback being printed to stderr when logging has problems and
151 accept utf-8 byte string without breaking. (Martin Packman, #714449)
152
153+* Some filesystems give ``EOPNOTSUPP`` when trying to call ``fdatasync``.
154+ This shouldn't be treated as a fatal error.
155+ (John Arbash Meinel, #1075108)
156+
157 * Use ``encoding_type='exact'`` for ``bzr testament`` so that on Windows
158 the sha hash of the long testament matches the sha hash in the short
159 form. (John Arbash Meinel, #1010339)
160
161=== modified file 'doc/en/release-notes/bzr-2.5.txt'
162--- doc/en/release-notes/bzr-2.5.txt 2012-09-07 13:15:02 +0000
163+++ doc/en/release-notes/bzr-2.5.txt 2013-05-23 09:32:44 +0000
164@@ -35,6 +35,10 @@
165 * ``bzr config`` properly handles aliases and references in the
166 ``--directory`` parameter (Vincent Ladeuil, Wouter van Heyst, #947049)
167
168+* Fix a traceback when trying to checkout a tree that also has an entry
169+ with file-id `TREE_ROOT` somewhere other than at the root directory.
170+ (John Arbash Meinel, #830947)
171+
172 * Lightweight checkouts of remote repositories had a bug with how they
173 extracted texts from the repository. (Just an ordering constraint on how
174 they consumed the stream.) (John Arbash Meinel, #1046284)
175@@ -48,6 +52,10 @@
176
177 * Revert use of --no-tty when gpg signing commits. (Jelmer Vernooij, #1014570)
178
179+* Some filesystems give ``EOPNOTSUPP`` when trying to call ``fdatasync``.
180+ This shouldn't be treated as a fatal error.
181+ (John Arbash Meinel, #1075108)
182+
183 * Some small bug fixes wrt lightweight checkouts and remote repositories.
184 A test permutation was added that runs all working tree tests against a
185 lightweight checkout. (John Arbash Meinel, #1046697)

Subscribers

People subscribed via source and target branches