-
Notifications
You must be signed in to change notification settings - Fork 218
PermissionDenied exception related to MoveFileEx on Windows #1904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report @SiriusStarr! :) For reference, it's this code that writes files to the "semi-semantic" dhall-haskell/dhall/src/Dhall/Import.hs Lines 716 to 721 in e22ecde
The use of This is the And this is the http://hackage.haskell.org/package/directory-1.3.6.1/docs/System-Directory.html#v:renameFile I admittedly don't have a huge amount of trust in the @jneira As our Windows expert, would you have a recommendation how to tackle this? :) |
My suspicion is that the |
@SiriusStarr: Also, I suspect the reason this only affects the first test is because that's the one that populates the cache |
I just noticed this bit from the
That sounds as if the package was never meant to guarantee atomicity on Windows. I must have missed that when I picked it to address #1540. |
The underlying primitive that On a POSIX system it's a wrapper around Either way, it seems like an issue that would need to be fixed upstream, in either the |
I guess we should try to make a bug report then. We could also try creating a workaround in In any case, it would be good to have a proper reproducer for the issue. @SiriusStarr Could you possibly help us with that? |
Okay, after fidgeting around, I've been able to reproduce it pretty simply on my own windows box, rather than in CI. Requirements:
Minimal {-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import qualified Dhall as D
import Test.Hspec
main :: IO ()
main = hspec $ parallel $ do
it "import 1" $ D.input D.auto "let B = https://prelude.dhall-lang.org/Bool/package.dhall in B.not True" `shouldReturn` False
it "import 2" $ D.input D.auto "let B = https://prelude.dhall-lang.org/Bool/package.dhall in B.not False" `shouldReturn` True To reproduce: import 1
import 2 FAILED [1]
Failures:
src\Main.hs:12:3:
1) import 2
uncaught exception: IOException of type PermissionDenied
C:\Users\Username\AppData\Local\dhall-haskell\ato3EE7.write: renameFile:renamePath:MoveFileEx "\\\\?\\C:\\Users\\Username\\AppData\\Local\\dhall-haskell\\ato3EE7.write" Just "\\\\?\\C:\\Users\\Username\\AppData\\Local\\dhall-haskell\\1220262d2dcb718ae7f37b6ce6142fb0aa73b714802582809d20ad49d8e4627f35ff": permission denied (Access is denied.)
To rerun use: --match "/import 2/"
Randomized with seed 74949068
Finished in 0.6375 seconds
2 examples, 1 failure
resolver: lts-16.0
packages:
- .
name: atomic-write-err
version: 0.1.0.0
dependencies:
- base >= 4.7 && < 5
- dhall >= 1.32
- hspec >= 2.7.1
executables:
atomic-write-err:
main: Main.hs
source-dirs: src
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N |
I opened an issue here: haskell/directory#109 |
(Opening an issue here rather than keeping it on Slack.)
Windows builds of a project using Dhall (in Haskell) have been failing seemingly at random on Github's CI. Sometimes the tests succeed normally, sometimes they fail (always in this way). I've been unable to reproduce the problem on an actual Windows computer, where the whole test suite passes fine.
The hex values change, e.g. this was another error thrown on a different build:
The test in question that is failing is simply importing a Dhall expression from a file (using
Dhall.inputFile
) and comparing it to an expected Haskell value (i.e. no file manipulation is occurring beyond whateverDhall.inputFile
is doing). It is always the very first import on a test run that fails, with all others seeming to succeed fine.Turning off hspec's parallel spec evaluation just for this first spec seems to fix the error, even though parallel spec evaluation can be on for any number of other specs that also include
Dhall.inputFile
. So this may be a non-issue, but it still seems peculiar, since it seems to be Windows-specific.The text was updated successfully, but these errors were encountered: