Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re #6372 Depend on tar-0.6.2.0 #6550

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ dependencies:
- rio-prettyprint >= 0.1.8.0
- split
- stm
- tar >= 0.5.1.1 && < 0.6.0.0
- tar >= 0.6.2.0
- template-haskell
- text
- time
Expand Down Expand Up @@ -157,7 +157,6 @@ library:
- Build_stack
- Paths_stack
exposed-modules:
- Codec.Archive.Tar.Utf8
- Control.Concurrent.Execute
- Data.Attoparsec.Args
- Data.Attoparsec.Combinators
Expand Down
182 changes: 0 additions & 182 deletions src/Codec/Archive/Tar/Utf8.hs

This file was deleted.

9 changes: 2 additions & 7 deletions src/Stack/SDist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ module Stack.SDist
, readLocalPackage
) where

import qualified Codec.Archive.Tar.Utf8 as Tar
import qualified Codec.Archive.Tar as Tar
import qualified Codec.Archive.Tar.Entry as Tar
import qualified Codec.Compression.GZip as GZip
import Conduit ( runConduitRes, sourceLazy, sinkFileCautious )
import Control.Concurrent.Execute
( ActionContext (..), Concurrency (..) )
import Control.Monad.Extra ( whenJust )
import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as S8
import qualified Data.ByteString.Lazy as L
import Data.Char ( toLower )
import Data.Data ( cast )
Expand Down Expand Up @@ -252,13 +251,9 @@ getSDistTarball mpvpBounds pkgDir = do
-- prone and more predictable to read everything in at once, so that's what
-- we're doing for now:
let tarPath isDir fp =
case Tar.toTarPath isDir (forceUtf8Enc (pkgIdName FP.</> fp)) of
case Tar.toTarPath isDir (pkgIdName FP.</> fp) of
Left e -> prettyThrowIO $ ToTarPathException e
Right tp -> pure tp
-- convert a String of proper characters to a String of bytes in UTF8
-- encoding masquerading as characters. This is necessary for tricking the
-- tar package into proper character encoding.
forceUtf8Enc = S8.unpack . T.encodeUtf8 . T.pack
packWith f isDir fp = liftIO $ f (pkgFp FP.</> fp) =<< tarPath isDir fp
packDir = packWith Tar.packDirectoryEntry True
packFile fp
Expand Down
7 changes: 7 additions & 0 deletions stack-ghc-9.8.2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

snapshot: nightly-2024-04-04 # GHC 9.8.2

extra-deps:
# Dependency of tar >= 0.6.2.0:
- os-string-2.0.2@sha256:32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e,3259
# nightly-2024-04-04 provides tar-0.5.1.1, which does not support Unicode
# filenames:
- tar-0.6.2.0@sha256:619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba,4576

docker:
enable: false
repo: quay.io/benz0li/ghc-musl:9.8.1
Expand Down
16 changes: 15 additions & 1 deletion stack-ghc-9.8.2.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files

packages: []
packages:
- completed:
hackage: os-string-2.0.2@sha256:32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e,3259
pantry-tree:
sha256: 5b1dbaf1663005907462032997264b7942befb9fc108491c1fdd5e488ac0817e
size: 2217
original:
hackage: os-string-2.0.2@sha256:32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e,3259
- completed:
hackage: tar-0.6.2.0@sha256:619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba,4576
pantry-tree:
sha256: 1dde50961e9d1a6e6f820d918c0edbbd9673c83afdd300e0aae40a691e8151df
size: 2168
original:
hackage: tar-0.6.2.0@sha256:619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba,4576
snapshots:
- completed:
sha256: 31177dd01e2b7801b9347776d892d1e808396c21ab3b60f7f8c96856bdbe5f52
Expand Down
9 changes: 4 additions & 5 deletions stack.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ flag supported-build

library
exposed-modules:
Codec.Archive.Tar.Utf8
Control.Concurrent.Execute
Data.Attoparsec.Args
Data.Attoparsec.Combinators
Expand Down Expand Up @@ -409,7 +408,7 @@ library
, rio-prettyprint >=0.1.8.0
, split
, stm
, tar >=0.5.1.1 && <0.6.0.0
, tar >=0.6.2.0
, template-haskell
, text
, time
Expand Down Expand Up @@ -532,7 +531,7 @@ executable stack
, split
, stack
, stm
, tar >=0.5.1.1 && <0.6.0.0
, tar >=0.6.2.0
, template-haskell
, text
, time
Expand Down Expand Up @@ -634,7 +633,7 @@ executable stack-integration-test
, rio-prettyprint >=0.1.8.0
, split
, stm
, tar >=0.5.1.1 && <0.6.0.0
, tar >=0.6.2.0
, template-haskell
, text
, time
Expand Down Expand Up @@ -752,7 +751,7 @@ test-suite stack-unit-test
, split
, stack
, stm
, tar >=0.5.1.1 && <0.6.0.0
, tar >=0.6.2.0
, template-haskell
, text
, time
Expand Down
4 changes: 4 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ extra-deps:
# Cabal is pruned because process is a GHC boot package, and has to be specified
# again.
- Cabal-3.10.1.0@sha256:6d11adf7847d9734e7b02785ff831b5a0d11536bfbcefd6634b2b08411c63c94,12316
# Dependency of tar >= 0.6.2.0:
- os-string-2.0.2@sha256:32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e,3259
- pantry-0.10.0@sha256:6f99ee8d7cfeeb0e2513638618acf80c72d018e7f10120048fa120a409b9dcd2,7864
# GHC 9.6.4 comes with process-1.6.17.0, which can segfault on macOS.
- process-1.6.18.0@sha256:cd0a3e0376b5a8525983d3131a31e52f9ffefc278ce635eec45a9d3987b8be3e,3025
# lts-22.7 provides tar-0.5.1.1, which does not support Unicode filenames:
- tar-0.6.2.0@sha256:619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba,4576

docker:
enable: false
Expand Down
14 changes: 14 additions & 0 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ packages:
size: 9223
original:
hackage: Cabal-3.10.1.0@sha256:6d11adf7847d9734e7b02785ff831b5a0d11536bfbcefd6634b2b08411c63c94,12316
- completed:
hackage: os-string-2.0.2@sha256:32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e,3259
pantry-tree:
sha256: 5b1dbaf1663005907462032997264b7942befb9fc108491c1fdd5e488ac0817e
size: 2217
original:
hackage: os-string-2.0.2@sha256:32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e,3259
- completed:
hackage: pantry-0.10.0@sha256:6f99ee8d7cfeeb0e2513638618acf80c72d018e7f10120048fa120a409b9dcd2,7864
pantry-tree:
Expand All @@ -25,6 +32,13 @@ packages:
size: 1675
original:
hackage: process-1.6.18.0@sha256:cd0a3e0376b5a8525983d3131a31e52f9ffefc278ce635eec45a9d3987b8be3e,3025
- completed:
hackage: tar-0.6.2.0@sha256:619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba,4576
pantry-tree:
sha256: 1dde50961e9d1a6e6f820d918c0edbbd9673c83afdd300e0aae40a691e8151df
size: 2168
original:
hackage: tar-0.6.2.0@sha256:619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba,4576
snapshots:
- completed:
sha256: 7b975b104cb3dbf0c297dfd01f936a4d2ee523241dd0b1ae960522b833fe3027
Expand Down
1 change: 1 addition & 0 deletions tests/integration/tests/6372-sdist-unicode-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
stack.yaml.lock
22 changes: 22 additions & 0 deletions tests/integration/tests/6372-sdist-unicode-test/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import StackTest

import Control.Monad (unless)

-- | The test fails at runtime on the Windows Server 2022 GitHub-hosted runner
-- only, at the point of outputting a Unicode character, with:
--
-- <stderr>: commitAndReleaseBuffer: invalid argument (cannot encode character '\1633')
--
-- That appears to be similar to
-- https://gitlab.haskell.org/ghc/ghc/-/issues/8118, however: (1) the locale is
-- set to C.UTF-8 and the active code page is 65001; and
-- (2) `GHC.IO.Encoding.setLocaleEncoding utf8` has no effect.
--
-- Until the origin of the problem is identified, we disable the test on
-- Windows.

main :: IO ()
main = unless isWindows $ do
stack ["clean"]
stack ["build", "--dry-run"]
stack ["sdist", "."]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: test١٢٣
version: 0.1.0.0
license: BSD-3-Clause
description: Test of Unicode characters in file names
dependencies:
- base < 5
library:
source-dirs: src
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Libαβγ
( someFunc
) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
snapshot: lts-22.7
Loading