[commit: ghc] wip/nfs-locking: Use doesDirectoryExist to workaround a getDirectoryContents bug. (34c999b)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:52:06 UTC 2017


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

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/34c999b8e9d78b848ef75f8b439b408eafdf7166/ghc

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

commit 34c999b8e9d78b848ef75f8b439b408eafdf7166
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Thu Jan 14 13:01:48 2016 +0000

    Use doesDirectoryExist to workaround a getDirectoryContents bug.
    
    See #168.


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

34c999b8e9d78b848ef75f8b439b408eafdf7166
 src/Rules/Gmp.hs     | 4 +---
 src/Rules/Library.hs | 5 ++++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs
index f6d6fe8..c788ed2 100644
--- a/src/Rules/Gmp.hs
+++ b/src/Rules/Gmp.hs
@@ -118,10 +118,8 @@ gmpRules = do
 
         createDirectory $ takeDirectory gmpLibraryH
         -- check whether we need to build in tree gmp
-        -- this is indicated by line "HaveFrameworkGMP = YES" in `config.mk`
         configMk <- liftIO . readFile $ gmpBase -/- "config.mk"
-        if "HaveFrameworkGMP = YES" `isInfixOf` configMk
-               || "HaveLibGmp = YES" `isInfixOf` configMk
+        if any (`isInfixOf` configMk) ["HaveFrameworkGMP = YES", "HaveLibGmp = YES"]
         then do
             putBuild "| GMP library/framework detected and will be used"
             copyFile gmpLibraryFakeH gmpLibraryH
diff --git a/src/Rules/Library.hs b/src/Rules/Library.hs
index 6b2180c..0ffaf3f 100644
--- a/src/Rules/Library.hs
+++ b/src/Rules/Library.hs
@@ -84,5 +84,8 @@ extraObjects :: PartialTarget -> Action [FilePath]
 extraObjects (PartialTarget _ pkg)
     | pkg == integerGmp = do
         orderOnly [gmpLibraryH] -- TODO: move this dependency elsewhere, #113?
-        getDirectoryFiles "" [gmpObjects -/- "*.o"]
+        exists <- doesDirectoryExist gmpObjects
+        if exists
+        then getDirectoryFiles "" [gmpObjects -/- "*.o"]
+        else return []
     | otherwise         = return []



More information about the ghc-commits mailing list