[commit: ghc] master, wip/fix-ghci-ci, wip/pat-builder: compiler: Disable atomic renaming on Windows (1c1b63d)

git at git.haskell.org git at git.haskell.org
Sun Mar 17 19:07:52 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branches: master,wip/fix-ghci-ci,wip/pat-builder
Link       : http://ghc.haskell.org/trac/ghc/changeset/1c1b63d63efe8b0f789aa7d5b87cfac3edd213eb/ghc

>---------------------------------------------------------------

commit 1c1b63d63efe8b0f789aa7d5b87cfac3edd213eb
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sat Mar 16 08:57:43 2019 -0400

    compiler: Disable atomic renaming on Windows
    
    As discussed in #16450, this feature regresses CI on Windows, causing
    non-deterministic failures due to missing files.


>---------------------------------------------------------------

1c1b63d63efe8b0f789aa7d5b87cfac3edd213eb
 compiler/utils/Util.hs | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/compiler/utils/Util.hs b/compiler/utils/Util.hs
index 41f63f2..6730881 100644
--- a/compiler/utils/Util.hs
+++ b/compiler/utils/Util.hs
@@ -1314,7 +1314,8 @@ modificationTimeIfExists f = do
 -- also results in a skip.
 
 withAtomicRename :: (MonadIO m) => FilePath -> (FilePath -> m a) -> m a
-withAtomicRename targetFile f = do
+withAtomicRename targetFile f
+  | enableAtomicRename = do
   -- The temp file must be on the same file system (mount) as the target file
   -- to result in an atomic move on most platforms.
   -- The standard way to ensure that is to place it into the same directory.
@@ -1325,6 +1326,17 @@ withAtomicRename targetFile f = do
   liftIO $ renameFile temp targetFile
   return res
 
+  | otherwise = f targetFile
+  where
+    -- As described in #16450, enabling this causes spurious build failures due
+    -- to apparently missing files.
+    enableAtomicRename :: Bool
+#if defined(mingw32_BUILD_OS)
+    enableAtomicRename = False
+#else
+    enableAtomicRename = True
+#endif
+
 -- --------------------------------------------------------------
 -- split a string at the last character where 'pred' is True,
 -- returning a pair of strings. The first component holds the string



More information about the ghc-commits mailing list