diff options
-rwxr-xr-x | fusearchive.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fusearchive.py b/fusearchive.py index b63f35d..f009d3b 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -14,7 +14,7 @@ from errno import * from stat import * from fuse import Fuse -#import pdb +import pdb if not hasattr(fuse, '__version__'): raise RuntimeError, \ @@ -30,6 +30,8 @@ debug_level = 0 # These control some of the file output magic_blocksize = 1024 * 128 +# Use a tiny block size to debug writes, so you can use a smaller test file +#magic_blocksize = 1024 magic_depth = 5 gzip_compress_level = 6 @@ -493,12 +495,17 @@ class FuseArchive(Fuse): dmsg( 3, "Writing final " + str( buf_remain ) + " bytes" ) this_len = buf_remain + dmsg( 3, "Bytes to copy: " + str(this_len) ) + dmsg( 3, " buf offset: " + str(buf_offset) ) + dmsg( 3, " chunk offset: " + str(rest) ) + # Since python doesn't do in-place reassignment like you # can with splice() we will reconstruct the data by joining # stuff by offsets (first chars to skip, then our joining # buf chunk, the everything that would have been after it) + #pdb.set_trace() self.chunk = self.chunk[ :rest ] + \ - buf[ buf_offset:this_len ] + \ + buf[ buf_offset:(buf_offset+this_len) ] + \ self.chunk[ (rest + this_len): ] buf_offset += this_len @@ -509,6 +516,7 @@ class FuseArchive(Fuse): self.chunk_modified = True self.modified = True + dmsg( 3, "Chunk size is now: " + str(len(self.chunk)) ) return len(buf) # BUG: If you cp -a a file then quickly ls -l sometimes it doesn't show |