#2808: createDirectoryIfMissing should be atomic
------------------------------------+---------------------------------------
    Reporter:  EricKow              |        Owner:  igloo           
        Type:  merge                |       Status:  new             
    Priority:  normal               |    Milestone:  6.10.2          
   Component:  libraries/directory  |      Version:  6.10.1          
    Severity:  normal               |   Resolution:                  
    Keywords:                       |   Difficulty:  Unknown         
    Testcase:                       |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple     |  
------------------------------------+---------------------------------------
Changes (by simonmar):

  * owner:  simonmar => igloo
  * type:  bug => merge

Comment:

 See also #2924, uncovered while testing this patch.

 To merge:

 {{{
 Thu Dec 18 14:47:04 GMT Standard Time 2008  Duncan Coutts
 <[email protected]>
   * Alternative implementation of createDirectoryIfMissing

 Mon Dec 22 16:41:05 GMT Standard Time 2008  Duncan Coutts
 <[email protected]>
   * Fix createDirectoryIfMissing to not throw if the dir got deleted
   When we call createDirectory and some file system object already exists
   we have a problem. We need to distinguish if it is a file that already
   exists or if it is a directory because in the latter case it is not an
   error. Previously we called doesDirectoryExist however that does not
   distinguish the dir not existing (due to another thread deleting it)
   and an ordinary file existing. We now use withFileStatus to throw the
   original AlreadyExistsError only if a non-directory object exists.
   So now the only time we should get a spurious exception is if another
   thread deletes the directory and puts a file in its place between our
   call to createDirectory and withFileStatus. It should now be safe to
   race createDirectoryIfMissing with itself or deleteDirectoryRecursive.

 Wed Feb  4 16:33:19 GMT Standard Time 2009  Simon Marlow
 <[email protected]>
   * fix this test for the new version of createDirectoryIfMissing (#2808)
   - add another race test, for two threads both doing create;cleanup
   - ignore isDoesNotExistErrors in create
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2808#comment:14>
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

Reply via email to