libarchive 2.1.3.2 → 2.2.0.0
raw patch · 10 files changed
+15/−9 lines, 10 files
Files
- CHANGELOG.md +4/−0
- libarchive.cabal +1/−1
- src/Codec/Archive.hs +1/−0
- src/Codec/Archive/Pack.hs +3/−2
- src/Codec/Archive/Pack/Common.hs +1/−1
- src/Codec/Archive/Types.hs +1/−1
- src/Codec/Archive/Types/Foreign.chs +1/−1
- src/Codec/Archive/Unpack.hs +1/−1
- test/Codec/Archive/Roundtrip.hs +1/−1
- test/Spec.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,9 @@ # libarchive +## 2.2.0.0++ * Haskell `Entry` type now includes `Symlink` field+ ## 2.1.3.2 * Fix segfault in strict function
libarchive.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: libarchive-version: 2.1.3.2+version: 2.2.0.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018-2019 Vanessa McHale
src/Codec/Archive.hs view
@@ -27,6 +27,7 @@ -- * Concrete (Haskell) types , ArchiveResult (..) , Entry (..)+ , Symlink (..) , EntryContent (..) , Ownership (..) , Permissions
src/Codec/Archive/Pack.hs view
@@ -40,8 +40,9 @@ contentAdd Directory a entry = do liftIO $ archiveEntrySetFiletype entry (Just FtDirectory) handle $ archiveWriteHeader a entry-contentAdd (Symlink fp) a entry = do+contentAdd (Symlink fp st) a entry = do liftIO $ archiveEntrySetFiletype entry (Just FtLink)+ liftIO $ archiveEntrySetSymlinkType entry st liftIO $ withCString fp $ \fpc -> archiveEntrySetSymlink entry fpc handle $ archiveWriteHeader a entry@@ -78,7 +79,7 @@ where entrySz e = 512 + 512 * (contentSz (content e) `div` 512 + 1) contentSz (NormalFile str) = fromIntegral $ BS.length str contentSz Directory = 0- contentSz (Symlink fp) = fromIntegral $ length fp+ contentSz (Symlink fp _) = 1 + fromIntegral (length fp) contentSz (Hardlink fp) = fromIntegral $ length fp --idk if this is right -- | Returns a 'BS.ByteString' containing a tar archive with the 'Entry's
src/Codec/Archive/Pack/Common.hs view
@@ -14,7 +14,7 @@ (True, False, False, 1) -> NormalFile <$> BS.readFile fp (True, False, False, _) -> pure $ Hardlink fp (False, True, False, _) -> pure Directory- (False, False, True, _) -> Symlink <$> readSymbolicLink fp+ (False, False, True, _) -> Symlink <$> readSymbolicLink fp <*> pure SymlinkUndefined (_, _, _, _) -> error "inconsistent read result" mkEntry :: FilePath -> IO Entry
src/Codec/Archive/Types.hs view
@@ -39,7 +39,7 @@ -- TODO: support everything here: http://hackage.haskell.org/package/tar/docs/Codec-Archive-Tar-Entry.html#t:EntryContent data EntryContent = NormalFile !BS.ByteString | Directory- | Symlink !FilePath+ | Symlink !FilePath !Symlink | Hardlink !FilePath deriving (Show, Eq)
src/Codec/Archive/Types/Foreign.chs view
@@ -67,7 +67,7 @@ {# enum define Symlink { AE_SYMLINK_TYPE_UNDEFINED as SymlinkUndefined , AE_SYMLINK_TYPE_FILE as SymlinkFile , AE_SYMLINK_TYPE_DIRECTORY as SymlinkDirectory- } deriving (Eq)+ } deriving (Show, Eq) #} {# enum define ArchiveFilter { ARCHIVE_FILTER_NONE as ArchiveFilterNone
src/Codec/Archive/Unpack.hs view
@@ -128,7 +128,7 @@ readContents a entry = go =<< archiveEntryFiletype entry where go Nothing = Hardlink <$> (peekCString =<< archiveEntryHardlink entry) go (Just FtRegular) = NormalFile <$> (readBS a =<< sz)- go (Just FtLink) = Symlink <$> (peekCString =<< archiveEntrySymlink entry)+ go (Just FtLink) = Symlink <$> (peekCString =<< archiveEntrySymlink entry) <*> archiveEntrySymlinkType entry go (Just FtDirectory) = pure Directory go (Just _) = error "Unsupported filetype" sz = fromIntegral <$> archiveEntrySize entry
test/Codec/Archive/Roundtrip.hs view
@@ -31,7 +31,7 @@ ("}" ++) showsContent (NormalFile bytes) = ("(NormalFile $ " ++) . shows (BS.take 10 bytes) . (" <> undefined)" ++) showsContent Directory = ("Directory" ++)- showsContent (Symlink target) = ("(Symlink " ++) . shows target . (')':)+ showsContent (Symlink target _) = ("(Symlink " ++) . shows target . (')':) showsContent (Hardlink target) = ("(Hardlink " ++) . shows target . (')':) joinBy :: ShowS -> [ShowS] -> ShowS joinBy sep = thread . intersperse sep
test/Spec.hs view
@@ -40,7 +40,7 @@ let entries = [ simpleDir "x/" , simpleFile "x/a.txt" (NormalFile "referenced")- , simpleFile "x/b.txt" (Symlink "a.txt")+ , simpleFile "x/b.txt" (Symlink "a.txt" SymlinkUndefined) ] itPacksUnpacks entries itPacksUnpacksViaFS entries