Skip to content

Commit

Permalink
Make fingerprint calculation non-locale dependent.
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
  • Loading branch information
ezyang committed Aug 29, 2015
1 parent e69b252 commit 3535425
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Cabal/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ import Control.Exception
import Control.Monad
( liftM, when, unless, foldM, filterM )
import Distribution.Compat.Binary ( decodeOrFailIO, encode )
import GHC.Fingerprint ( Fingerprint(..), fingerprintString
import GHC.Fingerprint ( Fingerprint(..), fingerprintData
#if __GLASGOW_HASKELL__ >= 710
, getFileHash
#endif
Expand All @@ -153,7 +153,7 @@ import Data.Monoid
import qualified Data.Map as Map
import Data.Map (Map)
import Data.Traversable
( mapM )
( mapM, forM )
import Data.Typeable
import Data.Char ( chr, isAlphaNum )
import Numeric ( showIntAtBase, showHex )
Expand Down Expand Up @@ -1318,7 +1318,9 @@ computeIPID pkg_descr dep_ipids flagAssignment = do
#if __GLASGOW_HASKELL__ >= 710
mapM getFileHash files
#else
mapM (\x -> readFile x >>= (evaluate . fingerprintString)) files
forM files $ \f -> do
bs <- BS.readFile f
BS.useAsCString bs $ \(ptr, len) -> fingerprintData ptr len
#endif
-- show is found to be faster than intercalate and then replacement of
-- special character used in intercalating. We cannot simply hash by
Expand Down

0 comments on commit 3535425

Please sign in to comment.