Skip to content

Commit

Permalink
Merge pull request #2864 from commercialhaskell/no-create-database-ra…
Browse files Browse the repository at this point in the history
…ce-condition

Fix createDatabase by checking for package.cache
  • Loading branch information
borsboom authored Dec 20, 2016
2 parents 9938300 + c7bd758 commit 43cdfa9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Bug fixes:
[#2852](https://github.com/commercialhaskell/stack/issues/2852).
* `get-stack.sh` now installs correct binary on ARM for generic linux and raspbian,
closing [#2856](https://github.com/commercialhaskell/stack/issues/2856).
* Correct the testing of whether a package database exists by checking
for the `package.cache` file itself instead of the containing
directory.

## 1.3.0

Release notes:
Expand Down
4 changes: 2 additions & 2 deletions src/Stack/GhcPkg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import Data.Text.Extra (stripCR)
import Path (Path, Abs, Dir, toFilePath, parent)
import Path (Path, Abs, Dir, toFilePath, parent, mkRelFile, (</>))
import Path.Extra (toFilePathNoTrailingSep)
import Path.IO
import Prelude hiding (FilePath)
Expand Down Expand Up @@ -87,7 +87,7 @@ ghcPkg menv wc pkgDbs args = do
createDatabase :: (MonadIO m, MonadLogger m, MonadBaseControl IO m, MonadCatch m)
=> EnvOverride -> WhichCompiler -> Path Abs Dir -> m ()
createDatabase menv wc db = do
exists <- doesDirExist db
exists <- doesFileExist (db </> $(mkRelFile "package.cache"))
unless exists $ do
-- Creating the parent doesn't seem necessary, as ghc-pkg
-- seems to be sufficiently smart. But I don't feel like
Expand Down

0 comments on commit 43cdfa9

Please sign in to comment.