patch applied (ghc-6.10/packages/directory): Fix createDirectoryIfMissing to not throw if the dir got deleted

Ian Lynagh igloo at earth.li
Tue Feb 10 14:47:37 EST 2009


Mon Dec 22 08:41:05 PST 2008  Duncan Coutts <duncan at haskell.org>
  * 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.

    M ./System/Directory.hs -5 +9

View patch online:
http://darcs.haskell.org/ghc-6.10/packages/directory/_darcs/patches/20081222164105-adfee-0b3aca51d1fe74de9168352283eee19b85ca16e1.gz


More information about the Cvs-libraries mailing list