From e359815f31d40f3f7f8c6ed4b225a0181e6c2b8d Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Tue, 28 Jul 2009 09:53:12 -0700 Subject: Always open the main fh for serialization in rw mode diff --git a/fusearchive.py b/fusearchive.py index ba50084..1c8cfb6 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -289,6 +289,7 @@ class FuseArchiveSerializer: f = gzip.GzipFile( None, "wb", gzip_compress_level, fh ) #f = fh cPickle.dump( obj, f ) + del f fh.flush() @staticmethod @@ -503,8 +504,9 @@ class FuseArchive(Fuse): # files works (in the create a read-only file for writing case) src = "./tree" + path logging.debug( "Saving fh for " + src ) - self.file = os.fdopen( os.open( src, flags, *mode ), - flag2mode( flags ) ) + nflags = os.O_RDWR + self.file = os.fdopen( os.open( src, nflags, *mode ), + flag2mode( nflags ) ) if preexist: # Read in file info table @@ -517,7 +519,7 @@ class FuseArchive(Fuse): self.chunks = magic[ 'chunks' ] self.chunk_size = magic[ 'chunk_size' ] except Exception, e: - logging.critical( e ) + logging.critical( self.orig_path + ": " + str( e ) ) else: if self.wr: logging.debug( "File doesn't exist and we're going to write, creating temp empty file" ) @@ -567,6 +569,8 @@ class FuseArchive(Fuse): # This simply puts the chunk data inside our current chunks at chunk_index def _save_chunk(self): if self.chunk_modified: + logging.debug( "Saving chunk " + str(self.chunk_index) ) + # Make sure we have room for this chunk size = len( self.chunks ) if self.chunk_index >= size: @@ -753,7 +757,7 @@ class FuseArchive(Fuse): } ) - + logging.debug( "_fflush exit" ) return 1 -- cgit v0.10.2