tar 0.4.0.1 → 0.4.1.0
raw patch · 4 files changed
+32/−9 lines, 4 filesdep ~basedep ~directoryPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, directory
API changes (from Hackage documentation)
Files
- Codec/Archive/Tar/Check.hs +6/−4
- Codec/Archive/Tar/Read.hs +12/−0
- Codec/Archive/Tar/Types.hs +4/−0
- tar.cabal +10/−5
Codec/Archive/Tar/Check.hs view
@@ -112,7 +112,8 @@ -- Given the expected subdirectory, this function checks all entries are within -- that subdirectroy. ----- Note: This check must be used in conjunction with 'checkSecurity'.+-- Note: This check must be used in conjunction with 'checkSecurity'+-- (or 'checkPortability'). -- checkTarbomb :: FilePath -> Entries e -> Entries (Either e TarBombError) checkTarbomb expectedTopDir = checkEntries (checkEntryTarbomb expectedTopDir)@@ -189,8 +190,9 @@ | otherwise = Nothing where- posixPath = fromTarPathToPosixPath (entryTarPath entry)- windowsPath = fromTarPathToWindowsPath (entryTarPath entry)+ tarPath = entryTarPath entry+ posixPath = fromTarPathToPosixPath tarPath+ windowsPath = fromTarPathToWindowsPath tarPath portableFileType ftype = case ftype of NormalFile {} -> True@@ -201,7 +203,7 @@ portableChar c = c <= '\127' --- | Potential portability issues in a tar archive+-- | Portability problems in a tar archive data PortabilityError = NonPortableFormat Format | NonPortableFileType
Codec/Archive/Tar/Read.hs view
@@ -20,6 +20,8 @@ import Numeric (readOct) import Control.Exception (Exception) import Data.Typeable (Typeable)+import Control.Applicative+import Control.Monad import qualified Data.ByteString.Lazy as BS import qualified Data.ByteString.Lazy.Char8 as BS.Char8@@ -194,11 +196,21 @@ getString :: Int64 -> Int64 -> ByteString -> String getString off len = BS.Char8.unpack . BS.Char8.takeWhile (/='\0') . getBytes off len +-- These days we'd just use Either, but in older versions of base there was no+-- Monad instance for Either, it was in mtl with an anoying Error constraint.+-- data Partial e a = Error e | Ok a partial :: Partial e a -> Either e a partial (Error msg) = Left msg partial (Ok x) = Right x++instance Functor (Partial e) where+ fmap = liftM++instance Applicative (Partial e) where+ pure = return+ (<*>) = ap instance Monad (Partial e) where return = Ok
Codec/Archive/Tar/Types.hs view
@@ -465,3 +465,7 @@ instance Monoid (Entries e) where mempty = Done mappend a b = foldEntries Next b Fail a++instance Functor Entries where+ fmap f = foldEntries Next Done (Fail . f)+
tar.cabal view
@@ -1,12 +1,12 @@ name: tar-version: 0.4.0.1+version: 0.4.1.0 license: BSD3 license-file: LICENSE author: Bjorn Bringert <bjorn@bringert.net> Duncan Coutts <duncan@community.haskell.org> maintainer: Duncan Coutts <duncan@community.haskell.org> copyright: 2007 Bjorn Bringert <bjorn@bringert.net>- 2008-2012 Duncan Coutts <duncan@community.haskell.org>+ 2008-2015 Duncan Coutts <duncan@community.haskell.org> category: Codec synopsis: Reading, writing and manipulating ".tar" archive files. description: This library is for working with \"@.tar@\" archive files. It@@ -23,10 +23,15 @@ type: darcs location: http://code.haskell.org/tar/ +flag old-time+ library- build-depends: base >= 3 && < 5, filepath,- bytestring, directory,- old-time, time+ build-depends: base == 4.*, filepath,+ bytestring, directory+ if flag(old-time)+ build-depends: directory < 1.2, old-time+ else+ build-depends: directory >= 1.2, time exposed-modules: Codec.Archive.Tar