From 614720058d96957be369769e6add7f556f642dc8 Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Tue, 28 Jul 2009 22:52:17 -0700 Subject: Be more explicit about saving chunks, since some other parts of the code look at len(self.chunks) and this is NOT extended until we do a _save_chunk diff --git a/fusearchive.py b/fusearchive.py index 9a06c92..e86a774 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -674,19 +674,22 @@ class FuseArchive(Fuse): logging.debug( "This chunk falls on index: " + str( index ) + " rest: " + str( rest ) ) logging.debug( "We have " + str( len( self.chunks ) ) + " chunks" ) + logging.debug( "File size is: " + str( self.size ) ) # If index is higher than the number of blocks we current have it's a seek hole, so we need to extend our blocks out # We know these need to essentially be zeroed up to this size since if len( self.chunks ) - 1 < index: logging.debug( "Not enough chunks " + str( len( self.chunks ) ) + ", need " + - str( index ) + ", extending" ) + str( index + 1 ) + ", extending" ) this_index = 0 while this_index < index: self._load_chunk( this_index ) fill_null = self.chunk_size - len(self.chunk) logging.debug( "Filling this chunk with null, bytes: " + str( fill_null ) ) self.chunk += "\0" * fill_null + logging.debug( "Chunk is now: " + str( len( self.chunk) ) + " bytes" ) self.chunk_modified = True + self._save_chunk() this_index += 1 self._load_chunk( index ) @@ -697,6 +700,7 @@ class FuseArchive(Fuse): logging.debug( "Filling final chunk with null, bytes: " + str( fill_null ) ) self.chunk += "\0" * fill_null self.chunk_modified = True + self._save_chunk() buf_offset = 0 buf_len = len(buf) @@ -746,12 +750,14 @@ class FuseArchive(Fuse): index += 1 self.chunk_modified = True + self._save_chunk() self.modified = True if offset + len(buf) > self.size: self.size = offset + len(buf) - logging.debug( "Chunk size is now: " + str(len(self.chunk)) ) + logging.debug( "This chunk size is now: " + str(len(self.chunk)) ) logging.debug( "File size is now: " + str(self.size) ) + logging.debug( "Num Chunks: " + str( len( self.chunks ) ) ) # Mark us in the dirty cache dirty_cache[ self.orig_path ] = self -- cgit v0.10.2