[Python-Dev] Ext4 data loss
Toshio Kuratomi
a.badger at gmail.com
Thu Mar 12 15:43:55 CET 2009
Antoine Pitrou wrote:
> Steven D'Aprano <steve <at> pearwood.info> writes:
>> It depends on what you mean by "temporary".
>>
>> Applications like OpenOffice can sometimes recover from an application
>> crash or even a systems crash and give you the opportunity to restore
>> the temporary files that were left lying around.
>
> For such files, you want deterministic naming in order to find them again, so
> you won't use the tempfile module...
>
Something that doesn't require deterministicly named tempfiles was Ted
T'so's explanation linked to earlier.
read data from important file
modify data
create tempfile
write data to tempfile
*sync tempfile to disk*
mv tempfile to filename of important file
The sync is necessary to ensure that the data is written to the disk
before the old file overwrites the new filename.
-Toshio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090312/6ed3e6e4/attachment.pgp>
More information about the Python-Dev
mailing list