[commit: packages/Cabal] ghc-head: Don't forget to close the 'index-00.tar' handle. (73b8aed)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:22:43 CEST 2013


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

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=73b8aed17b5876ec29ca7f6c19c2f8e86a6d409c

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

commit 73b8aed17b5876ec29ca7f6c19c2f8e86a6d409c
Author: Mikhail Glushenkov <the.dead.shall.rise at gmail.com>
Date:   Mon Apr 29 16:49:27 2013 +0200

    Don't forget to close the 'index-00.tar' handle.


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

73b8aed17b5876ec29ca7f6c19c2f8e86a6d409c
 cabal-install/Distribution/Client/IndexUtils.hs |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/cabal-install/Distribution/Client/IndexUtils.hs b/cabal-install/Distribution/Client/IndexUtils.hs
index f18bdb1..680e985 100644
--- a/cabal-install/Distribution/Client/IndexUtils.hs
+++ b/cabal-install/Distribution/Client/IndexUtils.hs
@@ -129,8 +129,6 @@ convert index' = PackageIndex.fromList
 --
 -- This is a higher level wrapper used internally in cabal-install.
 --
--- FIXME: 'getSourcePackages' has a lazy IO bug that leads to a 'resource busy'
--- error when opening the "index-00.tar" file for a second time.
 getSourcePackages :: Verbosity -> [Repo] -> IO SourcePackageDb
 getSourcePackages verbosity [] = do
   warn verbosity $ "No remote package servers have been specified. Usually "
@@ -373,9 +371,9 @@ readPackageIndexCacheFile :: Package pkg
                           -> FilePath
                           -> IO (PackageIndex pkg, [Dependency])
 readPackageIndexCacheFile mkPkg indexFile cacheFile = do
-  indexHnd <- openFile indexFile ReadMode
   cache    <- liftM readIndexCache (BSS.readFile cacheFile)
-  packageIndexFromCache mkPkg indexHnd cache
+  withFile indexFile ReadMode $ \indexHnd ->
+    packageIndexFromCache mkPkg indexHnd cache
 
 
 packageIndexFromCache :: Package pkg





More information about the ghc-commits mailing list