diff --git a/cabal-install/Distribution/Client/CmdSdist.hs b/cabal-install/Distribution/Client/CmdSdist.hs index 545cacfcb7b26790c879897edb34cc5f329e2c20..335c6937b91c3e495040c0365060250841037740 100644 --- a/cabal-install/Distribution/Client/CmdSdist.hs +++ b/cabal-install/Distribution/Client/CmdSdist.hs @@ -72,6 +72,7 @@ import Control.Monad.Writer.Lazy ( WriterT, tell, execWriterT ) import Data.Bits ( shiftL ) +import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Lazy.Char8 as BSL import Data.Either ( partitionEithers ) @@ -259,7 +260,7 @@ packageToSdist verbosity projectRootDir format outputFile pkg = do Left err -> liftIO $ die' verbosity ("Error packing sdist: " ++ err) Right path -> tell [Tar.directoryEntry path] - contents <- liftIO $ BSL.readFile file + contents <- liftIO . fmap BSL.fromStrict . BS.readFile $ file case Tar.toTarPath False (prefix </> file) of Left err -> liftIO $ die' verbosity ("Error packing sdist: " ++ err) Right path -> tell [(Tar.fileEntry path contents) { Tar.entryPermissions = perm' }] diff --git a/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.out b/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.out new file mode 100644 index 0000000000000000000000000000000000000000..b4285f11bf3a3e3e14905dbb34d6089bd9720aaf --- /dev/null +++ b/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.out @@ -0,0 +1,2 @@ +# cabal new-sdist +Wrote tarball sdist to <ROOT>/many-data-files.dist/source/dist-newstyle/sdist/many-data-files-0.tar.gz diff --git a/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.test.hs b/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.test.hs index 497507c159ecd44eb3a3c97066e3dd845f157120..915f0c218c2000993946248b308faf56a41a1d04 100644 --- a/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.test.hs +++ b/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.test.hs @@ -11,5 +11,5 @@ main = cabalTest . withSourceCopy $ do liftIO $ createDirectoryIfMissing False (cwd </> "data") forM_ [1 .. n + 100] $ \i -> liftIO $ BS.writeFile (cwd </> "data" </> ("data-file-" ++ show i) <.> "txt") (BS.pack "a data file\n") - expectBroken 5541 $ cabal "new-sdist" ["many-data-files"] + cabal "new-sdist" ["many-data-files"] Nothing -> skip