deepseq all things returned from ResourceT http
Potentially fixes https://git-annex.branchable.com/bugs/concurrent_git-annex-copy_to_s3_special_remote_fails/ although I don't know if it does. My thinking is, ResourceT may allocate a resource and then free it, and a unforced thunk to that resource could result in reading memory that has since been overwritten by something else, or in a SEGV, depending. While that seems kind of like a bug in ResourceT to me, if it is what's happening, this will avoid it. If it's not, this doesn't really hurt much since the values are all smallish. This commit was sponsored by Graham Spencer on Patreon.
This commit is contained in:
parent
e26960752c
commit
ddf963d019
4 changed files with 66 additions and 32 deletions
|
@ -5,6 +5,8 @@
|
|||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
|
||||
module Types.Export (
|
||||
ExportLocation,
|
||||
mkExportLocation,
|
||||
|
@ -20,12 +22,16 @@ import Utility.Split
|
|||
import Utility.FileSystemEncoding
|
||||
|
||||
import qualified System.FilePath.Posix as Posix
|
||||
import GHC.Generics
|
||||
import Control.DeepSeq
|
||||
|
||||
-- A location on a remote that a key can be exported to.
|
||||
-- The RawFilePath will be relative to the top of the remote,
|
||||
-- and uses unix-style path separators.
|
||||
newtype ExportLocation = ExportLocation RawFilePath
|
||||
deriving (Show, Eq)
|
||||
deriving (Show, Eq, Generic)
|
||||
|
||||
instance NFData ExportLocation
|
||||
|
||||
mkExportLocation :: RawFilePath -> ExportLocation
|
||||
mkExportLocation = ExportLocation . toInternalGitPath
|
||||
|
|
|
@ -5,10 +5,14 @@
|
|||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
|
||||
module Types.Import where
|
||||
|
||||
import qualified Data.ByteString as S
|
||||
import Data.Char
|
||||
import Control.DeepSeq
|
||||
import GHC.Generics
|
||||
|
||||
import Types.Export
|
||||
import Utility.QuickCheck
|
||||
|
@ -29,7 +33,9 @@ fromImportLocation = fromExportLocation
|
|||
- the repository. It should be reasonably short since it is stored in the
|
||||
- git-annex branch. -}
|
||||
newtype ContentIdentifier = ContentIdentifier S.ByteString
|
||||
deriving (Eq, Ord, Show)
|
||||
deriving (Eq, Ord, Show, Generic)
|
||||
|
||||
instance NFData ContentIdentifier
|
||||
|
||||
instance Arbitrary ContentIdentifier where
|
||||
-- Avoid non-ascii ContentIdentifiers because fully arbitrary
|
||||
|
@ -47,4 +53,6 @@ data ImportableContents info = ImportableContents
|
|||
-- files that are stored in them. This is equivilant to a git
|
||||
-- commit history.
|
||||
}
|
||||
deriving (Show)
|
||||
deriving (Show, Generic)
|
||||
|
||||
instance NFData info => NFData (ImportableContents info)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue