projects
/
tahoe-lafs
/
tahoe-lafs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f3d7304
)
repairer: fix flaw in testutil.flip_one_bit() that Brian pointed out
author
Zooko O'Whielacronx
<zooko@zooko.com>
Thu, 16 Oct 2008 19:48:48 +0000
(12:48 -0700)
committer
Zooko O'Whielacronx
<zooko@zooko.com>
Thu, 16 Oct 2008 19:48:48 +0000
(12:48 -0700)
src/allmydata/util/testutil.py
patch
|
blob
|
history
diff --git
a/src/allmydata/util/testutil.py
b/src/allmydata/util/testutil.py
index 27e4f0695069150526f12bf94e657e7c07cc30b4..84911306936d9d677ce33711b87ff1c4b6f8f43f 100644
(file)
--- a/
src/allmydata/util/testutil.py
+++ b/
src/allmydata/util/testutil.py
@@
-19,7
+19,7
@@
def flip_one_bit(s, offset=0, size=None):
""" flip one random bit of the string s, in a byte greater than or equal to offset and less
than offset+size. """
if size is None:
- size=len(s)
+ size=len(s)
-offset
i = randrange(offset, offset+size)
result = s[:i] + chr(ord(s[i])^(0x01<<randrange(0, 8))) + s[i+1:]
assert result != s, "Internal error -- flip_one_bit() produced the same string as its input: %s == %s" % (result, s)