News for hackers. Stuff that matters.
Re:Things Unix can do atomically (2010) by dmm on Monday May 30, 2016 @07:06PM (#11803720)
rename(2) was not atomic on OS X for years. It was finally fixed in Lion: http://www.weirdnet.nl/apple/rename.html
Re:Things Unix can do atomically (2010) by LukeShu on Monday May 30, 2016 @07:13PM (#11803743)
It should also be said that `mv`(1) is only atomic if the source and destination are on the same filesystem.
Re:Things Unix can do atomically (2010) by mancerayder on Monday May 30, 2016 @10:46PM (#11804260)
So 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?
Re:Things Unix can do atomically (2010) by Dylan16807 on Monday May 30, 2016 @10:57PM (#11804289)
It'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.
Re:Things Unix can do atomically (2010) by Sanddancer on Monday May 30, 2016 @11:26PM (#11804364)
Very implausible. Mv across filesystems is usually implemented as a copy then delete. Worst case, you'll have the data exist in both locations.
Re:Things Unix can do atomically (2010) by nshepperd on Tuesday May 31, 2016 @12:11AM (#11804506)
It'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).