[GHC] #1413: copyFile: atomicity docs/code mismatch

GHC trac at galois.com
Tue Jun 5 15:22:24 EDT 2007


#1413: copyFile: atomicity docs/code mismatch
-----------------------------+----------------------------------------------
  Reporter:  guest           |          Owner:         
      Type:  bug             |         Status:  new    
  Priority:  normal          |      Milestone:         
 Component:  libraries/base  |        Version:  6.6.1  
  Severity:  normal          |       Keywords:         
Difficulty:  Unknown         |             Os:  Unknown
  Testcase:                  |   Architecture:  Unknown
-----------------------------+----------------------------------------------
http://haskell.org/ghc/docs/latest/html/libraries/base/System-
 Directory.html#v%3AcopyFile says:

   copyFile old new copies the existing file from old to new. If the new
 file already exists, it is ''atomically replaced'' by the old file.
 Neither path may refer to an existing directory. The permissions of old
 are copied to new, if possible.

 AFAIK the only way to do atomic replacement is to write to a temporary
 file, then rename it over the target. However, strace shows that copyFile
 does open(), ftruncate(), then multiple write()s; this is clearly not
 atomic.

 Conclusion: Either the docs or the code are wrong.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1413>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
-------------- next part --------------
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs at haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


More information about the Glasgow-haskell-bugs mailing list