View Single Post
  #39  
Old 01.10.2011, 13:53
weaverslodge
Guest
 
Posts: n/a
Default

I agree that if a download fails and cannot be resumed that the file should be deleted, no problem with that at all. But if the download is complete and the final stage is to rename the file then that is different.

I appreciate what you say about atomic operations, it's something that I always associate with databases also and in a database context it's fine as you have recovery daemons and the like in the event of a DB crash. For journaled filesystems I guess you could make the rename across filesystems clean up should a crash occur although there is only one stage of the process that you have to worry about. If it crashes during the copy then it will clean up, but if it crashes after the copy but before the unlink then I'm not sure it would be able to deal with it.

The checking of copied files is another matter. From a hardware point of view you have to assume that if you make a request for a file to be moved then it will be and the data will be transferred faithfully. If there is a problem then the hardware will report the problem. From an OS point of view, the fundamental commands do the job that they have been doing for years. They will issue reads and writes and check the return codes and that's all. If you want them to do more than that then you have to look at third party software. If you can't trust the OS to copy a file I wouldn't use that OS (probably why I use Mac's :-))

In reality though if you were to check or compare then every copy would at least double in duration.

I think my main point though was about the removal of a perfectly good file just because it failed to rename it !
Reply With Quote