-
Notifications
You must be signed in to change notification settings - Fork 842
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
stack sdist does not handle filenames with non-ASCII characters #2549
Comments
Possibly helpful snippet of code just using #!/usr/bin/env stack
-- stack runghc --resolver lts-6.14 --package tar
{-# LANGUAGE OverloadedStrings #-}
import Codec.Archive.Tar
import Codec.Archive.Tar.Entry
import qualified Data.ByteString.Lazy as L
import System.Process
import System.Exit
main :: IO ()
main = do
let fp = "accenté.txt"
Right tarPath = toTarPath False fp
writeFile fp "test1"
L.writeFile "tarintl.tar" $ write [fileEntry tarPath "test2"]
rawSystem "tar" ["xfv", "tarintl.tar"] >>= exitWith |
Hmm, in the Cabal source code I see the following comment, which may explain why it works:
|
And an ugly workaround is discovered: #!/usr/bin/env stack
-- stack runghc --resolver lts-6.14 --package tar --package text
{-# LANGUAGE OverloadedStrings #-}
import Codec.Archive.Tar
import Codec.Archive.Tar.Entry
import qualified Data.ByteString.Lazy as L
import System.Process
import System.Exit
import qualified Data.ByteString.Char8 as S8
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
main :: IO ()
main = do
let fp = "accenté.txt"
Right tarPath = toTarPath False $ S8.unpack $ T.encodeUtf8 $ T.pack fp
writeFile fp "test1"
L.writeFile "tarintl.tar" $ write [fileEntry tarPath "test2"]
rawSystem "tar" ["xfv", "tarintl.tar"] >>= exitWith |
borsboom
added a commit
that referenced
this issue
Sep 5, 2016
Force UTF8 encoding for tar paths in sdist (fixes #2549)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
git clone https://github.com/snoyberg/yaml
cd yaml
git checkout yaml/0.8.18.2
stack sdist
tar xfv .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/yaml-0.8.18.3.tar.gz
Expected
All files unpack correctly.
Actual
I get the following error from tar due to an incorrectly generated tarball:
Stack version
Method of installation
Related to: snoyberg/yaml#92
The text was updated successfully, but these errors were encountered: