[Python-Dev] Ext4 data loss (original) (raw)
Toshio Kuratomi a.badger at gmail.com
Thu Mar 12 22:38:28 CET 2009
- Previous message: [Python-Dev] Ext4 data loss
- Next message: [Python-Dev] Ext4 data loss
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Martin v. Löwis wrote:
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. You still wouldn't use the tempfile module in that case. Instead, you would create a regular file, with the name base on the name of the important file. Uhm... why? The requirements are:
- lifetime of the temporary file is in control of the app
- filename is available to the app so it can move it after data is written
- temporary file can be created on the same filesystem as the important file.
All of those are doable using the tempfile module.
-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/ddfbb0e5/attachment.pgp>
- Previous message: [Python-Dev] Ext4 data loss
- Next message: [Python-Dev] Ext4 data loss
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]