3 ms·
I'm not familiar with the term "unit" in this context, could you elaborate on this as a type?
by bogomipz 10y ago
I'm not familiar with the term "unit" in this context, could you elaborate on this as a type?
- js2 10y agoAtomic. Either the old file or the new file is seen for a given path. Posix has this semantics already if you always write to a temp file on the same FS and then rename (I think this may not be true if the system crashes however, and it's not true for NFS).
- bogomipz 10y agoAh ok, unit as in an "atomic unit." Thanks.
- Animats 10y agoThat's the problem. Doesn't work for NFS. Rename is not atomic on some file systems. Crashes may leave temp files behind. Moving files from one directory to another may not be atomic. Renaming API for NTFS differs for different versions of Windows. See this two-year discussion of trying to get this to work right for the Python library.[1] Do not taunt Happy Fun Ball. This should Just Work. [1] https://bugs.python.org/issue8828 https://bugs.python.org/issue8828
- bogomipz 10y ago>"Moving files from one directory to another may not be atomic." I was intrigued that you said "may not", can you elaborate on when it is vs when it isn't? >"Do not taunt Happy Fun Ball." This really made me laugh :)
- lloeki 10y agoOn OS X / HFS+ it wasn't atomic before Snow Leopard, and bug-free before Lion[0] [0]: http://www.weirdnet.nl/apple/rename.html http://www.weirdnet.nl/apple/rename.html