Author neologix
Recipients Trundle, draghuram, eric.araujo, giampaolo.rodola, neologix, pitrou, r.david.murray, tarek, techtonik, vstinner
Date 2011-10-23.11:07:58
SpamBayes Score 3.188e-07
Marked as misclassified No
Message-id <1319368079.31.0.0860958044408.issue8828@psf.upfronthosting.co.za>
In-reply-to
Content
The recent issue #13146 renewed my interest, so I'd like to make this move forward, since I think an atomic rename/write API could be quite useful.
Issue #8604 (Adding an atomic FS write API) can be achieved relatively easily with the typical (fsync() left aside)
- create temporary file
- write to the temp file
- atomically rename the temp file to the target path

But the problem is that rename is only atomic on POSIX, and not on Windows.
So I'd suggest to:
- rename this issue to target specifically Windows ;-)
- add MoveFileTransacted to the standard library (PC/msvcrtmodule.c, posixmodule?)

I'm -1 on exposing a "best effort" atomic rename/file API: either the OS offers the primitives necessary to achieve atomicity, or it doesn't. It's better to have a working implementation on some OSes than a flaky implementation on every OS.

Note that I'll happily take over the atomic file API part (issue #8604), but since my Windows kung-fu is so poor, it'd be nice if someone with some Windows experience could tackle this MoveFileTransacted
History
Date User Action Args
2011-10-23 11:07:59neologixsetrecipients: + neologix, pitrou, vstinner, draghuram, techtonik, giampaolo.rodola, tarek, eric.araujo, r.david.murray, Trundle
2011-10-23 11:07:59neologixsetmessageid: <1319368079.31.0.0860958044408.issue8828@psf.upfronthosting.co.za>
2011-10-23 11:07:58neologixlinkissue8828 messages
2011-10-23 11:07:58neologixcreate