Java bug opened in 1996, closed with "Will Not Fix", last comment ("i am facing similar issue.") in 2008: Would you prefer to not define the function instead of writing a pseudo-atomic function? The documentation must give a list of the OS on which the function is atomic. It seems you are proposing to call "atomic" something which isn't atomic:ĭate: Yes, as I wrote: it's not possible to write an atomic function for all OS. Atomic rename of a directory is much more complex :-) Note: this issue is only about renaming a *file*. Should we also implement a atomic version of shutil.move()? Support rename if the source and the destination are on different file systems. ![]() Should Python detect the file system type to choose the algorithm? I would like to say no, because I consider that as a file system (or kernel) bug, not a Python bug. But other virtual file systems may not implement atomic rename (eg. It looks like rename is atomic, it's just a bug about notification. Gnome (nautilus) had a bug on rename because NFS emitted a delete notification on a rename: We have to think about network file systems like NFS. the original bug (5398777) was resolved in Snow Leopard but the issue I reported was not fixed." > This implementation is atomic on POSIX. What can we do if "rename(src, dst)" fails? # use maybe a PRNG instead of a dummy counter or tempfile " context manager.īegin by removing the dest file is maybe not the safer approach :-) Here is a new try: begin by renaming the dest file to a new file. See issue #8604: proposal of a new "with atomic_write(filename) as fp. It can be improved later by adding the support of better Windows functions. This implementation is atomic on POSIX, and not atomic on Windows. Note: os.rename() uses MoveFileW() on Windows. ![]() The documentation will give a list of OS on which the operation *is* atomic (eg. I don't think that it's possible to write an atomic rename (file) function for any OS, so it's only a "best effort" atomic function. ![]() "If the file is to be moved to a different volume, the function simulates the move by using the CopyFile and DeleteFile functions."), version >= Windows 2000 MoveFileEx() with MOVEFILE_REPLACE_EXISTING and MOVEFILE_WRITE_THROUGH flags: not atomic (eg. MoveFileTransacted(): atomic! version >= (Windows Vista, Windows Server 2008) Windows offers different functions depending on the version: Os.rename() is atomic on Linux, but on Windows it raises an error if the destination does already exist. Trundle, draghuram, eric.araujo, giampaolo.rodola, neologix, pitrou, python-dev, r.david.murray, tarek, techtonik, vstinnerĬreated on 23:41 by vstinner, last changed 14:57 by admin.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |