Rev 6051: Backport fix for a random test failure in http://bazaar.launchpad.net/~vila/bzr/2.4-integration/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Thu Oct 6 13:15:54 UTC 2011
At http://bazaar.launchpad.net/~vila/bzr/2.4-integration/
------------------------------------------------------------
revno: 6051
revision-id: v.ladeuil+lp at free.fr-20111006131554-vhhv2e68toc5m864
parent: pqm at pqm.ubuntu.com-20111005090757-ismvukuzugd4tsp0
fixes bug: https://launchpad.net/bugs/807032
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 2.4.2-dev
timestamp: Thu 2011-10-06 15:15:54 +0200
message:
Backport fix for a random test failure
-------------- next part --------------
=== modified file 'bzrlib/tests/blackbox/test_branch.py'
--- a/bzrlib/tests/blackbox/test_branch.py 2011-08-09 13:46:26 +0000
+++ b/bzrlib/tests/blackbox/test_branch.py 2011-10-06 13:15:54 +0000
@@ -64,11 +64,21 @@
def test_branch_broken_pack(self):
"""branching with a corrupted pack file."""
self.example_branch('a')
- #now add some random corruption
- fname = 'a/.bzr/repository/packs/' + os.listdir('a/.bzr/repository/packs')[0]
+ # add some corruption
+ packs_dir = 'a/.bzr/repository/packs/'
+ fname = packs_dir + os.listdir(packs_dir)[0]
with open(fname, 'rb+') as f:
- f.seek(750)
- f.write("\xff")
+ # Start from the end of the file to avoid choosing a place bigger
+ # than the file itself.
+ f.seek(-5, os.SEEK_END)
+ c = f.read(1)
+ f.seek(-5, os.SEEK_END)
+ # Make sure we inject a value different than the one we just read
+ if c == '\xFF':
+ corrupt = '\x00'
+ else:
+ corrupt = '\xFF'
+ f.write(corrupt) # make sure we corrupt something
self.run_bzr_error(['Corruption while decompressing repository file'],
'branch a b', retcode=3)
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-10-04 18:43:55 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-10-06 13:15:54 +0000
@@ -72,6 +72,9 @@
suite. This can include new facilities for writing tests, fixes to
spurious test failures and changes to the way things should be tested.
+* Really corrupt the pack file without depending on a special length or value.
+ (Vincent Ladeuil, #807032)
+
bzr 2.4.1
#########
More information about the bazaar-commits
mailing list