aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-07-24 16:34:40 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-07-24 16:34:40 (GMT)
commit742e6c310601882dbf1048ed2973ea38cbfc3575 (patch)
tree0b226cc2d543890d95fad38d1c7e1cc75da0f629
parentf95912f7db95587df2b1cf4cae3cf26cf3caa7d8 (diff)
downloadfusearchive-742e6c310601882dbf1048ed2973ea38cbfc3575.zip
fusearchive-742e6c310601882dbf1048ed2973ea38cbfc3575.tar.gz
fusearchive-742e6c310601882dbf1048ed2973ea38cbfc3575.tar.bz2
Fix a bug with writing partial blocks
-rwxr-xr-xfusearchive.py12
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