#4968: openTempFile fails on Windows if a directory exists with the file name it
tries
-------------------------------+--------------------------------------------
Reporter: ganesh | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/base
Version: 7.0.1 | Keywords:
Testcase: | Blockedby:
Os: Windows | Blocking:
Architecture: x86_64 (amd64) | Failure: Incorrect result at runtime
-------------------------------+--------------------------------------------
The program below works on Linux but fails on Windows with "permission
denied" from the second openTempFile.
I think the reason is that findTempName in the openTempFile source doesn't
get eEXIST when a directory with the same name exists, so it fails instead
of trying again.
The real use case behind this code is making temp directories on multiple
threads simultaneously.
{{{
import Prelude
import System.IO
import System.Directory
main :: IO ()
main = do
dir <- getTemporaryDirectory
(npath1, handle1) <- openTempFile dir "tmp"
hClose handle1
removeFile npath1
createDirectory npath1
(npath2, handle2) <- openTempFile dir "tmp"
return ()
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4968>
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