zip 1.6.0 → 1.7.0
raw patch · 6 files changed
+52/−18 lines, 6 filesdep +unix
Dependencies added: unix
Files
- CHANGELOG.md +6/−0
- Codec/Archive/Zip.hs +11/−0
- Codec/Archive/Zip/Internal.hs +17/−2
- README.md +6/−6
- tests/Main.hs +6/−5
- zip.cabal +6/−5
CHANGELOG.md view
@@ -1,3 +1,9 @@+## Zip 1.7.0++* Set user permissions on linux platform as follows: if an existing file is+ added, use its permissions; if an entry is generated from a bytestring or+ a stream, use 0600. This behavior mimics the zip utility.+ ## Zip 1.6.0 * Added support for Zstandard (zstd) compression
Codec/Archive/Zip.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-}@@ -175,6 +176,11 @@ import qualified System.FilePath as FP import System.IO.Error (isDoesNotExistError) +#ifndef mingw32_HOST_OS+import qualified Codec.Archive.Zip.Unix as Unix+import qualified System.Posix as Unix+#endif+ ---------------------------------------------------------------------------- -- Archive monad @@ -454,6 +460,11 @@ let src = CB.sourceFile apath addPending (I.SinkEntry t src s) addPending (I.SetModTime modTime s)++#ifndef mingw32_HOST_OS+ status <- liftIO $ Unix.getFileStatus path+ setExternalFileAttrs (Unix.fromFileMode (Unix.fileMode status)) s+#endif -- | Copy an entry “as is” from another zip archive. If the entry does not -- exist in that archive, 'EntryDoesNotExist' will be eventually thrown.
Codec/Archive/Zip/Internal.hs view
@@ -65,6 +65,10 @@ import System.IO import System.IO.Error (isDoesNotExistError) +#ifndef mingw32_HOST_OS+import qualified Codec.Archive.Zip.Unix as Unix+#endif+ #ifdef ENABLE_BZIP2 import qualified Data.Conduit.BZlib as BZ #endif@@ -495,8 +499,8 @@ GenericOrigin -> currentTime Borrowed ed -> edModTime ed extFileAttr = case o of- GenericOrigin -> M.findWithDefault 0 s eaExtFileAttr- Borrowed _ -> M.findWithDefault 0 s eaExtFileAttr+ GenericOrigin -> M.findWithDefault defaultFileMode s eaExtFileAttr+ Borrowed _ -> M.findWithDefault defaultFileMode s eaExtFileAttr oldExtraFields = case o of GenericOrigin -> M.empty Borrowed ed -> edExtraField ed@@ -1197,4 +1201,15 @@ #else ffff = 0xffff ffffffff = 0xffffffff+#endif++-- | Default permissions for the files, permissions not set on windows,+-- and are set to rw on unix. It mimics behavior of zip utility+defaultFileMode :: Word32++#ifdef mingw32_HOST_OS+defaultFileMode = 0++#else+defaultFileMode = Unix.fromFileMode 0o600 #endif
README.md view
@@ -96,9 +96,9 @@ `zip` supports the following compression methods: * Store (no compression, just store files “as is”)-* [DEFLATE](deflate)-* [Bzip2](bzip2)-* [Zstandard](zstd)+* [DEFLATE]+* [Bzip2]+* [Zstandard] The best way to add a new compression method to the library is to write a conduit that will do the compression and publish it as a library. `zip` can@@ -283,6 +283,6 @@ [libzip]: https://en.wikipedia.org/wiki/Libzip [specification]: https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.3.TXT-[deflate]: https://en.wikipedia.org/wiki/DEFLATE-[bzip2]: https://en.wikipedia.org/wiki/Bzip2-[zstd]: https://en.wikipedia.org/wiki/Zstandard+[DEFLATE]: https://en.wikipedia.org/wiki/DEFLATE+[Bzip2]: https://en.wikipedia.org/wiki/Bzip2+[Zstandard]: https://en.wikipedia.org/wiki/Zstandard
tests/Main.hs view
@@ -116,11 +116,12 @@ instance Arbitrary RelPath where arbitrary = do p <-- intercalate "/"- <$> listOf1- ( (++) <$> vectorOf 3 charGen- <*> listOf1 charGen- )+ resize 10 $+ intercalate "/"+ <$> listOf1+ ( (++) <$> vectorOf 3 charGen+ <*> listOf1 charGen+ ) case mkEntrySelector p of Nothing -> arbitrary Just _ -> return (RelPath p)
zip.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.18 name: zip-version: 1.6.0+version: 1.7.0 license: BSD3 license-file: LICENSE.md maintainer: Mark Karpov <markkarpov92@gmail.com> author: Mark Karpov <markkarpov92@gmail.com>-tested-with: ghc ==8.6.5 ghc ==8.8.4 ghc ==8.10.1+tested-with: ghc ==8.6.5 ghc ==8.8.4 ghc ==8.10.3 homepage: https://github.com/mrkkrp/zip bug-reports: https://github.com/mrkkrp/zip/issues synopsis: Operations on zip archives@@ -52,7 +52,7 @@ default-language: Haskell2010 build-depends: base >=4.12 && <5.0,- bytestring >=0.9 && <0.11,+ bytestring >=0.9 && <0.12, case-insensitive >=1.2.0.2 && <1.3, cereal >=0.3 && <0.6, conduit >=1.3 && <1.4,@@ -96,7 +96,8 @@ cpp-options: -DZIP_OS=0 else- cpp-options: -DZIP_OS=3+ cpp-options: -DZIP_OS=3+ build-depends: unix <2.8 executable haskell-zip-app main-is: Main.hs@@ -123,7 +124,7 @@ build-depends: base >=4.12 && <5.0, QuickCheck >=2.4 && <3.0,- bytestring >=0.9 && <0.11,+ bytestring >=0.9 && <0.12, conduit >=1.3 && <1.4, containers >=0.5 && <0.7, directory >=1.2.2 && <1.4,