[Chandler-dev] Issues with exporting Chandler data

Phillip J. Eby pje at telecommunity.com
Mon Apr 21 12:36:22 PDT 2008


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. 



More information about the chandler-dev mailing list