#7184: Possible race condition in copyFile
------------------------------+---------------------------------------------
Reporter: Macil | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/directory
Version: 7.4.2 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: #5251 |
------------------------------+---------------------------------------------
Implementation of copyFile
1. Creates .copyFile.tmp at destination using openBinaryTempFile.
2. Copies contents of the source file using copyContents.
3. Renames the temporary file to source using renameFile.
Operations 2 and 3 are not atomic. If some program B expects file at the
destination then the race evolves: B sees .copyFileXXX.tmp instead of the
true file name and if B consumes file before rename then copyContens fails
due to renameFile failure.
Implementation seems strange to me. Why not just use system API? This
should also fix #5251
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7184>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs