diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-03-30 17:28:09 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-03-30 17:28:09 +0100 |
commit | 99369c6300422f812e261ed21da9865a2f653d29 (patch) | |
tree | 3739823a282785193b80edd73dfaa0e78d8f63d5 | |
parent | 84af1de018ab40f7b36428f2ce1d3a4d14240a67 (diff) | |
download | obnam-99369c6300422f812e261ed21da9865a2f653d29.tar.gz |
Apply patch from Valery to fix FUSE read
Patch by Valery Yundin. He gave the following recipe to verify it
works:
* set "ObnamFuseFile.keep_cache" to False
* backup
* mount
* diff -r the original and via FUSE
Before the patch this failed for me if the original file was large
enough, on the order of two to a hundred megs. It works after the
patch.
Someday I will have to really write a test suite for this.
-rw-r--r-- | obnamlib/plugins/fuse_plugin.py | 11 | ||||
-rw-r--r-- | test-gpghome/random_seed | bin | 600 -> 600 bytes |
2 files changed, 5 insertions, 6 deletions
diff --git a/obnamlib/plugins/fuse_plugin.py b/obnamlib/plugins/fuse_plugin.py index 5d736a67..0e9b12bc 100644 --- a/obnamlib/plugins/fuse_plugin.py +++ b/obnamlib/plugins/fuse_plugin.py @@ -171,15 +171,14 @@ class ObnamFuseFile(object): size_cache[chunkid] = len(contents) size = size_cache[chunkid] - if chunk_pos_in_file + size > offset: - start = offset - chunk_pos_in_file - n = length - output_length + if chunk_pos_in_file + size > offset + output_length: + start = offset + output_length - chunk_pos_in_file + n = min(length - output_length, size - start) if contents is None: contents = self.fuse_fs.obnam.repo.get_chunk_content( chunkid) - data = contents[start : start+n] - output.append(data) - output_length += len(data) + output.append(contents[start : start+n]) + output_length += n assert output_length <= length if output_length == length: break diff --git a/test-gpghome/random_seed b/test-gpghome/random_seed Binary files differindex 6a8dce29..f4ad4794 100644 --- a/test-gpghome/random_seed +++ b/test-gpghome/random_seed |