tar 0.4.4.0 → 0.4.5.0
raw patch · 5 files changed
+41/−18 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Codec.Archive.Tar.Entry: Ownership :: !ByteString -> !ByteString -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> Ownership
+ Codec.Archive.Tar.Entry: Ownership :: String -> String -> {-# UNPACK #-} !Int -> {-# UNPACK #-} !Int -> Ownership
- Codec.Archive.Tar.Entry: [groupName] :: Ownership -> !ByteString
+ Codec.Archive.Tar.Entry: [groupName] :: Ownership -> String
- Codec.Archive.Tar.Entry: [ownerName] :: Ownership -> !ByteString
+ Codec.Archive.Tar.Entry: [ownerName] :: Ownership -> String
Files
- Codec/Archive/Tar/Read.hs +2/−1
- Codec/Archive/Tar/Types.hs +20/−8
- Codec/Archive/Tar/Write.hs +11/−8
- changelog.md +7/−0
- tar.cabal +1/−1
Codec/Archive/Tar/Read.hs view
@@ -130,7 +130,8 @@ '7' -> NormalFile content size _ -> OtherEntryType typecode content size, entryPermissions = mode,- entryOwnership = Ownership uname gname uid gid,+ entryOwnership = Ownership (BS.Char8.unpack uname)+ (BS.Char8.unpack gname) uid gid, entryTime = mtime, entryFormat = format }
Codec/Archive/Tar/Types.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, GeneralizedNewtypeDeriving #-}+{-# LANGUAGE CPP, GeneralizedNewtypeDeriving, BangPatterns #-} ----------------------------------------------------------------------------- -- | -- Module : Codec.Archive.Tar.Types@@ -52,6 +52,7 @@ mapEntries, mapEntriesNoFail, foldEntries,+ foldlEntries, unfoldEntries, #ifdef TESTS@@ -140,10 +141,10 @@ data Ownership = Ownership { -- | The owner user name. Should be set to @\"\"@ if unknown.- ownerName :: !BS.ByteString,+ ownerName :: String, -- | The owner group name. Should be set to @\"\"@ if unknown.- groupName :: !BS.ByteString,+ groupName :: String, -- | Numeric owner user id. Should be set to @0@ if unknown. ownerId :: {-# UNPACK #-} !Int,@@ -185,7 +186,7 @@ rnf x = seq x () instance NFData Ownership where- rnf (Ownership _ _ _ _) = () -- fully strict by construction+ rnf (Ownership o g _ _) = rnf o `seq` rnf g -- | @rw-r--r--@ for normal files ordinaryFilePermissions :: Permissions@@ -213,7 +214,7 @@ entryPermissions = case content of Directory -> directoryPermissions _ -> ordinaryFilePermissions,- entryOwnership = Ownership BS.empty BS.empty 0 0,+ entryOwnership = Ownership "" "" 0 0, entryTime = 0, entryFormat = UstarFormat }@@ -494,6 +495,17 @@ fold Done = done fold (Fail err) = fail' err +-- | A 'foldl'-like function on Entries. It either returns the final+-- accumulator result, or the failure along with the intermediate accumulator+-- value.+--+foldlEntries :: (a -> Entry -> a) -> a -> Entries e -> Either (e, a) a+foldlEntries f z = go z+ where+ go !acc (Next e es) = go (f acc e) es+ go !acc Done = Right acc+ go !acc (Fail err) = Left (err, acc)+ -- | This is like the standard 'map' function on lists, but for 'Entries'. It -- includes failure as a extra possible outcome of the mapping function. --@@ -625,7 +637,7 @@ arbitrary = Ownership <$> name <*> name <*> idno <*> idno where- name = BS.pack <$> listOf0ToN 32 (arbitrary `suchThat` (/= 0))+ name = listOf0ToN 32 (arbitrary `suchThat` (/= '\0')) idno = arbitraryOctal 7 shrink (Ownership oname gname oid gid) =@@ -658,8 +670,8 @@ other -> other, entryOwnership = (entryOwnership entry) {- groupName = BS.empty,- ownerName = BS.empty+ groupName = "",+ ownerName = "" }, entryTarPath = let TarPath name _prefix = entryTarPath entry
Codec/Archive/Tar/Write.hs view
@@ -66,7 +66,7 @@ } = concat- [ putString 100 $ name+ [ putBString 100 $ name , putOct 8 $ permissions , putOct 8 $ ownerId ownership , putOct 8 $ groupId ownership@@ -74,27 +74,27 @@ , putOct 12 $ modTime , fill 8 $ ' ' -- dummy checksum , putChar8 $ typeCode- , putString 100 $ linkTarget+ , putBString 100 $ linkTarget ] ++ case format of V7Format -> fill 255 '\NUL' UstarFormat -> concat- [ putString 8 $ ustarMagic+ [ putBString 8 $ ustarMagic , putString 32 $ ownerName ownership , putString 32 $ groupName ownership , putOct 8 $ deviceMajor , putOct 8 $ deviceMinor- , putString 155 $ prefix+ , putBString 155 $ prefix , fill 12 $ '\NUL' ] GnuFormat -> concat- [ putString 8 $ gnuMagic+ [ putBString 8 $ gnuMagic , putString 32 $ ownerName ownership , putString 32 $ groupName ownership , putGnuDev 8 $ deviceMajor , putGnuDev 8 $ deviceMinor- , putString 155 $ prefix+ , putBString 155 $ prefix , fill 12 $ '\NUL' ] where@@ -122,8 +122,11 @@ type FieldWidth = Int -putString :: FieldWidth -> BS.ByteString -> String-putString n s = BS.Char8.unpack (BS.take n s) ++ fill (n - BS.length s) '\NUL'+putBString :: FieldWidth -> BS.ByteString -> String+putBString n s = BS.Char8.unpack (BS.take n s) ++ fill (n - BS.length s) '\NUL'++putString :: FieldWidth -> String -> String+putString n s = take n s ++ fill (n - length s) '\NUL' --TODO: check integer widths, eg for large file sizes putOct :: (Integral a, Show a) => FieldWidth -> a -> String
changelog.md view
@@ -1,3 +1,10 @@+0.4.5.0 Duncan Coutts <duncan@community.haskell.org> January 2016++ * Revert accidental minor API change in 0.4.x series (the type of the+ owner and group name strings). The 0.4.3.0 and 0.4.4.0 releases+ contained the accidental API change.+ * Add a handy foldlEntries function+ 0.4.4.0 Duncan Coutts <duncan@community.haskell.org> January 2016 * Build and warning fixes for GHC 7.10 and 8.0
tar.cabal view
@@ -1,5 +1,5 @@ name: tar-version: 0.4.4.0+version: 0.4.5.0 license: BSD3 license-file: LICENSE author: Duncan Coutts <duncan@community.haskell.org>