3 ms·
rename(2) was not atomic on OS X for years. It was finally fixed in Lion: http://www.weirdnet.nl/apple/rename.html http://www.weirdnet.nl/apple/rename.html
by dmm 10y ago
rename(2) was not atomic on OS X for years. It was finally fixed in Lion: http://www.weirdnet.nl/apple/rename.html http://www.weirdnet.nl/apple/rename.html
- LukeShu 10y agoIt should also be said that `mv`(1) is only atomic if the source and destination are on the same filesystem.
- mancerayder 10y agoSo that implies that realistically there's a scenario where moving files or directories from one filesystem to another and some interruption occurs can lead to lost data?
- Dylan16807 10y agoIt's easy to design an algorithm that either succeeds with a move or fails with a copy, never losing data, but someone would have to look deeper into what was actually guaranteed and/or implemented.
- deleted 10y ago[deleted]
- Sanddancer 10y agoVery implausible. Mv across filesystems is usually implemented as a copy then delete. Worst case, you'll have the data exist in both locations.
- nshepperd 10y agoIt's possible, in case of physical disconnection or power interruption. There is no guarantee that the copied data will be flushed out of buffers into nonvolatile storage before the delete is (unless the program asks for such a flush and the system honors it).