packages feed

libarchive 2.2.0.2 → 2.2.1.0

raw patch · 6 files changed

+20/−27 lines, 6 filesdep +pathological-bytestrings

Dependencies added: pathological-bytestrings

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # libarchive +## 2.2.1.0++  * Add `Exception` instance for `ArchiveResult`+ ## 2.2.0.2    * Use `bracket` where it doesn't crash GHC
libarchive.cabal view
@@ -1,6 +1,6 @@ cabal-version:   1.18 name:            libarchive-version:         2.2.0.2+version:         2.2.1.0 license:         BSD3 license-file:    LICENSE copyright:       Copyright: (c) 2018-2020 Vanessa McHale@@ -102,7 +102,8 @@         temporary -any,         mtl >=2.2.2,         dir-traverse -any,-        composition-prelude >=2.0.5.0+        composition-prelude >=2.0.5.0,+        pathological-bytestrings -any      if impl(ghc >=8.4)         ghc-options: -Wmissing-export-lists
src/Codec/Archive/Pack/Lazy.hs view
@@ -74,7 +74,7 @@     BSL.fromChunks . toList <$> liftIO (readIORef bsRef) <* liftIO (freeHaskellFunPtr cc)      where writeBSL bsRef _ _ bufPtr sz = do-            let bytesRead = min (fromIntegral sz) (32 * 1024)+            let bytesRead = min (fromIntegral sz) (32 * 1024) -- TODO: tweak this parameter             bsl <- packCStringLen (bufPtr, fromIntegral bytesRead)             modifyIORef' bsRef (`DL.snoc` bsl)             pure bytesRead
src/Codec/Archive/Types/Foreign.chs view
@@ -33,6 +33,7 @@                                    ) where  import           Control.DeepSeq    (NFData)+import           Control.Exception  (Exception) import           Data.Bits          (Bits (..)) import           Foreign.C.String   (CString) import           Foreign.C.Types    (CInt, CSize)@@ -51,7 +52,7 @@                              , ARCHIVE_WARN as ArchiveWarn                              , ARCHIVE_FAILED as ArchiveFailed                              , ARCHIVE_FATAL as ArchiveFatal-                             } deriving (Eq, Show, Generic, NFData)+                             } deriving (Eq, Show, Generic, NFData, Exception)   #}  {# enum define FileType { AE_IFREG as FtRegular
test/Codec/Archive/Roundtrip.hs view
@@ -6,15 +6,16 @@                                ) where  import           Codec.Archive-import           Control.Composition        (thread, (.@))-import           Control.Monad.Except       (liftEither)-import           Control.Monad.IO.Class     (liftIO)-import qualified Data.ByteString            as BS-import qualified Data.ByteString.Lazy       as BSL-import           Data.List                  (intersperse, sort)-import           System.Directory           (withCurrentDirectory)-import           System.Directory.Recursive (getDirRecursive)-import           System.IO.Temp             (withSystemTempDirectory)+import           Control.Composition          (thread, (.@))+import           Control.Monad.Except         (liftEither)+import           Control.Monad.IO.Class       (liftIO)+import qualified Data.ByteString              as BS+import qualified Data.ByteString.Lazy         as BSL+import           Data.ByteString.Pathological (nonstandardRead)+import           Data.List                    (intersperse, sort)+import           System.Directory             (withCurrentDirectory)+import           System.Directory.Recursive   (getDirRecursive)+import           System.IO.Temp               (withSystemTempDirectory) import           Test.Hspec  newtype TestEntries = TestEntries [Entry]@@ -47,12 +48,6 @@  roundtripFreaky :: FilePath -> IO (Either ArchiveResult BSL.ByteString) roundtripFreaky = roundtripRead nonstandardRead--nonstandardRead :: FilePath -> IO BSL.ByteString-nonstandardRead fp = do-    bStrict <- BS.readFile fp-    let (h, t) = BS.splitAt (64 * 1024) bStrict-    pure $ BSL.fromChunks [h, t]  itPacksUnpacks :: [Entry] -> Spec itPacksUnpacks entries = parallel $ it "packs/unpacks successfully without loss" $
test/Spec.hs view
@@ -12,14 +12,6 @@ import           System.IO.Temp          (withSystemTempDirectory) import           Test.Hspec -reChunk :: Int -> BS.ByteString -> [BS.ByteString]-reChunk bSz b =-    if BS.length b <= bSz-        then [b]-        else-            let (b', b'') = BS.splitAt bSz b-            in b' : reChunk bSz b''- testFp :: FilePath -> Spec testFp fp = parallel $ it ("sucessfully unpacks/packs (" ++ fp ++ ")") $     roundtrip fp >>= (`shouldSatisfy` isRight)