On 21 Apr, 2008, at 12:36, Phillip J. Eby wrote:
At 11:57 AM 4/21/2008 -0700, Grant Baillie wrote:
The existing code does an open() on the path to backup.chex, and
writes the data directly to that file. Unfortunately, this means that
your data can get erased, or left in an unusable, incomplete state if
Chandler or the OS crashes, or even if you Cancel the progress
dialog.
I have a patch that deals with this by writing all the data into an
in- memory buffer, and then writes that out to disk.
This means extra memory usage, but seems better than trying to deal
with platform-dependent issues that you get when writing to a
temporary file, and renaming it to the path you want. I Googled
around
some for ways of doing this in python, but didn't find anything
useful. Does anyone know of something better?
The simplest thing would probably be just to always write the backup
to a unique filename (backup-timestampint.chex?), and then delete
older files when done. The process that reads backup files could
then just default to the most-recently modified one.
Writing out the file with a '.tmp' extension that then gets removed
would prevent the restore process from reading an incompletely-
written file.
Hi, Phillip
Yes, that sounds like a more sensible way of doing things. I'll go
ahead and do that instead,
Thanks,
--Grant
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev