diff --git a/Cabal-tests/Cabal-tests.cabal b/Cabal-tests/Cabal-tests.cabal index c2e3047da04..19572b2d0d1 100644 --- a/Cabal-tests/Cabal-tests.cabal +++ b/Cabal-tests/Cabal-tests.cabal @@ -167,7 +167,7 @@ test-suite hackage-tests , clock >=0.8 && <0.9 , optparse-applicative >=0.13.2.0 && <0.19 , stm >=2.4.5.0 && <2.6 - , tar >=0.5.0.3 && <0.6 + , tar >=0.5.0.3 && <0.7 , tree-diff >=0.1 && <0.4 ghc-options: -Wall -rtsopts -threaded diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index 3cb68deb661..52d5f08edaa 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -227,7 +227,7 @@ library process >= 1.2.3.0 && < 1.7, random >= 1.2 && < 1.3, stm >= 2.0 && < 2.6, - tar >= 0.5.0.3 && < 0.6, + tar >= 0.5.0.3 && < 0.7, time >= 1.5.0.1 && < 1.13, zlib >= 0.5.3 && < 0.7, hackage-security >= 0.6.2.0 && < 0.7, diff --git a/cabal-install/src/Distribution/Client/Tar.hs b/cabal-install/src/Distribution/Client/Tar.hs index 313821a6b1a..898ad8898a7 100644 --- a/cabal-install/src/Distribution/Client/Tar.hs +++ b/cabal-install/src/Distribution/Client/Tar.hs @@ -69,8 +69,12 @@ extractTarGzFile -- ^ Tarball -> IO () extractTarGzFile dir expected tar = - Tar.unpack dir - . Tar.checkTarbomb expected + Tar.unpackAndCheck + ( \x -> + SomeException <$> Tar.checkEntryTarbomb expected x + <|> SomeException <$> Tar.checkEntrySecurity x + ) + dir . Tar.read . GZipUtils.maybeDecompress =<< BS.readFile tar diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Tar.hs b/cabal-install/tests/UnitTests/Distribution/Client/Tar.hs index 6295de6ace8..e772b416853 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Tar.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Tar.hs @@ -3,12 +3,14 @@ module UnitTests.Distribution.Client.Tar ) where import Codec.Archive.Tar - ( Entries (..) + ( Entries + , GenEntries (..) , foldEntries ) import Codec.Archive.Tar.Entry - ( Entry (..) - , EntryContent (..) + ( Entry + , GenEntryContent (..) + , entryContent , simpleEntry , toTarPath )