
Without knowing much about the surrounding code, I would try two things
here.
1. Is it possible that the file was opened by for writing and not closed
because of lazy I/O?
2. Since the error is completely deterministic, you could try "freezing"
evaluation right before the crash (either by a breakpoint in ghci or just
adding a time delay / console read on the code), and then using a utility
app
http://serverfault.com/questions/1966/how-do-you-find-what-process-is-holdin...
to
check which process is keeping the file open, whether it's the same process
or something else.
If any of the involved paths is a directory, this could be #8482
https://ghc.haskell.org/trac/ghc/ticket/8482, although that does not seem
to be the case.
On Thu, Oct 30, 2014 at 7:13 PM, Páli Gábor János
2014-10-30 16:24 GMT+01:00 Gintautas Miliauskas
: I wonder what's going on with DeleteFile. What is the step that's failing?
Basically it happens at the same point, that is, at the "configure" phase but at the ghc-prim package. Note that the previously mentioned workaround has a "removeFile" action [1], I guess the failure of that triggers the DeleteFile exception.
Can you post the log?
"inplace/bin/ghc-cabal.exe" configure libraries/ghc-prim dist-install "" --with-ghc="C:/msys64/home/ghc-builder/ghc/inplace/bin/ghc-stage1.exe" --with-ghc-pkg="C:/msys64/home/ghc-builder/ghc/inplace/bin/ghc-pkg.exe" --flag=include-ghc-prim --disable-library-for-ghci --enable-library-vanilla --enable-library-for-ghci --enable-library-profiling --disable-shared --configure-option=CFLAGS=" -U__i686 -march=i686 -fno-stack-protector " --configure-option=LDFLAGS=" " --configure-option=CPPFLAGS=" " --gcc-options=" -U__i686 -march=i686 -fno-stack-protector " --with-gcc="C:/msys64/home/ghc-builder/ghc/inplace/mingw/bin/gcc.exe" --with-ld="C:/msys64/home/ghc-builder/ghc/inplace/mingw/bin/ld.exe"
--configure-option=--with-cc="C:/msys64/home/ghc-builder/ghc/inplace/mingw/bin/gcc.exe" --with-ar="/usr/bin/ar" --with-alex="/usr/local/bin/alex" --with-happy="/usr/local/bin/happy" Configuring ghc-prim-0.3.1.0... ghc-cabal.exe: DeleteFile "dist-install\\setup-config": permission denied (The process cannot access the file because it is being used by another process.) libraries/ghc-prim/ghc.mk:4: recipe for target 'libraries/ghc-prim/dist-install/package-data.mk' failed make[1]: *** [libraries/ghc-prim/dist-install/package-data.mk] Error 1 Makefile:71: recipe for target 'all' failed
I also wonder why this issue is not arising on other Windows machines...
As the comment in the workaround goes, it has a "Big fat hairy race condition". Therefore I am inclined to believe that it may be a problem for other systems as well, but I am the most unfortunate one who hits this error with 100% probability :-)
[1] https://github.com/ghc/ghc/blob/master/libraries/bin-package-db/GHC/PackageD...
-- Gintautas Miliauskas