From 8c91367a60e68dea764dee457fac5570f9f0111b Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Tue, 28 Jul 2009 22:41:28 -0700 Subject: Catch when size == truncate size, some more debugging stuff diff --git a/fusearchive.py b/fusearchive.py index 9c13d68..9a06c92 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -793,7 +793,8 @@ class FuseArchive(Fuse): # If this assert fails then write/ftruncate failed to set # things up right somewhere - assert save_size == self.size, "Calculated size " + str( self.size ) \ + assert save_size == self.size, "Calculated size of " \ + + self.orig_path + " = " + str( self.size ) \ + " doesn't match internal size " + str( save_size ) \ + "\nProbably a bug in write or ftruncate!" logging.debug( "Size calculated is: " + str( self.size ) + ' (0x%x)' % self.size ) @@ -849,6 +850,7 @@ class FuseArchive(Fuse): need_chunks = ( length / self.chunk_size ) extra_bytes = length % self.chunk_size logging.debug( "Ftruncate - " + str(length) + ' (0x%x) ' % length ) + logging.debug( " - self.size: " + str( self.size ) ) logging.debug( " - curr_chunks: " + str( curr_chunks ) ) logging.debug( " - need_chunks: " + str( need_chunks ) ) logging.debug( " - extra_bytes: " + str( extra_bytes ) ) @@ -863,7 +865,7 @@ class FuseArchive(Fuse): logging.debug( "Creating 0 chunk file" ) self.chunks = [] self.chunk = '' - elif self.size < length: + elif self.size <= length: logging.debug( "Need to pad out file, writing/seeking to " + str( length ) ) # Just write out null bytes to the length requested, write will do this for us if we specify the offset -- cgit v0.10.2