[commit: ghc] wip/disable-atomic-rename-on-windows: compiler: Disable atomic renaming on Windows (6d7bfba)
git at git.haskell.org
git at git.haskell.org
Sat Mar 16 14:45:11 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/disable-atomic-rename-on-windows
Link : http://ghc.haskell.org/trac/ghc/changeset/6d7bfba77b8400e9ea56eb016dccae04c43cb08f/ghc
>---------------------------------------------------------------
commit 6d7bfba77b8400e9ea56eb016dccae04c43cb08f
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.
>---------------------------------------------------------------
6d7bfba77b8400e9ea56eb016dccae04c43cb08f
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