From a355262a94f6b3b98f67549078774fb7b09c1681 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 27 Apr 2005 08:25:46 +0000 Subject: [PATCH] [project @ 2005-04-27 08:25:46 by simonmar] newTempName: instead of bumping the processId until we find a name that isn't used, add an integer suffix to the processId. This should prevent temp-file conflicts that appear to have been affecting our nightly builds and occasionally make -j. The right way to allocate a temporary file is to create it straight away, but I'm not sure of the implications of passing existing temporary files to the various sub-processes that GHC executes, hence this fix instead. --- ghc/compiler/main/SysTools.lhs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/main/SysTools.lhs b/ghc/compiler/main/SysTools.lhs index 1124728..6dadee4 100644 --- a/ghc/compiler/main/SysTools.lhs +++ b/ghc/compiler/main/SysTools.lhs @@ -544,12 +544,12 @@ cleanTempFilesExcept dflags dont_delete newTempName :: DynFlags -> Suffix -> IO FilePath newTempName DynFlags{tmpDir=tmp_dir} extn = do x <- getProcessID - findTempName tmp_dir x + findTempName (tmp_dir ++ "/ghc" ++ show x ++ "_") 0 where - findTempName tmp_dir x - = do let filename = tmp_dir ++ "/ghc" ++ show x ++ '.':extn + findTempName prefix x + = do let filename = prefix ++ show x ++ '.':extn b <- doesFileExist filename - if b then findTempName tmp_dir (x+1) + if b then findTempName prefix (x+1) else do consIORef v_FilesToClean filename -- clean it up later return filename -- 1.7.10.4