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

cabal sdist corrupted when using Unicode #2558

Open
hvr opened this issue Apr 27, 2015 · 7 comments
Open

cabal sdist corrupted when using Unicode #2558

hvr opened this issue Apr 27, 2015 · 7 comments

Comments

@hvr
Copy link
Member

hvr commented Apr 27, 2015

$ git clone https://github.com/hvr/-.git 無
...
$ cd 無
$ runghc Setup.hs configure
Configuring 無-0...

$ runghc Setup.hs sdist
Distribution quality warnings:
No 'category' field.
No 'description' field.
Warning: Cannot run preprocessors. Run 'configure' command first.
Building source dist for 無-0...
Source tarball created: dist/無-0.tar.gz

$ tar tf dist/無-0.tar.gz
無-0/
無-0/無.cabal
無-0/Setup.hs
無-0/LICENSE

That works as expected; however, when using cabal-install:

$ rm -rf dist/

$ cabal --version
cabal-install version 1.22.2.0
using version 1.22.2.0 of the Cabal library

$ cabal configure
Resolving dependencies...
Configuring 無-0...

$ cabal sdist
Distribution quality warnings:
No 'category' field.
No 'description' field.
Warning: Cannot run preprocessors. Run 'configure' command first.
Building source dist for 無-0...
Source tarball created: dist/無-0.tar.gz

$ tar tf dist/無-0.tar.gz 
!-0/
!-0/!.cabal
!-0/Setup.hs
!-0/LICENSE

The resulting tarball has filenames with replaced by ! (fwiw, is UTF8-encoded as 0xe7 0x84 0xa1)

See also #2557

@ttuegel ttuegel added this to the cabal-install-1.24 milestone Apr 27, 2015
@23Skidoo
Copy link
Member

Once this is fixed, we should also add a regression test.

@ttuegel
Copy link
Member

ttuegel commented Apr 27, 2015

@hvr By the way, what operating system is this on, and what is your default encoding set to? (It should work correctly regardless of these facts, but knowing these may help to track it down.)

@hvr
Copy link
Member Author

hvr commented Apr 27, 2015

@ttuegel Ubuntu 15.04 w/ LANG=en_US.UTF-8; I'd expect this issue to be easily reproducible on any Linux distribution

@23Skidoo 23Skidoo modified the milestones: cabal-install 1.24, cabal-install 1.26 Feb 21, 2016
@trofi
Copy link
Contributor

trofi commented Sep 3, 2016

Real-world example:
https://github.com/snoyberg/yaml/blob/master/yaml.cabal#L23

cabal sdist packages it correctly on linux but cabal unpack unpacks it incorrectly:

$ ls -d test/resources/acc*
test/resources/accent  test/resources/accenté
$ runhaskell Setup.lhs sdist
Building source dist for yaml-0.8.18.4...
Preprocessing library yaml-0.8.18.4...
Preprocessing executable 'yaml2json' for yaml-0.8.18.4...
Preprocessing executable 'json2yaml' for yaml-0.8.18.4...
Preprocessing test suite 'spec' for yaml-0.8.18.4...
Source tarball created: dist/yaml-0.8.18.4.tar.gz

$ cabal unpack dist/yaml-0.8.18.4.tar.gz
Unpacking to yaml-0.8.18.4/

$ ls -d yaml-0.8.18.4/test/resources/acc*
yaml-0.8.18.4/test/resources/accenté

$ cabal --version
cabal-install version 1.24.0.0
compiled using version 1.24.0.0 of the Cabal library

$ locale
LANG=ru_RU.UTF-8

Note how é got corrupted to é.

@trofi
Copy link
Contributor

trofi commented Sep 3, 2016

Edward pointed out it's even more complicated: #3758

@gbaz
Copy link
Collaborator

gbaz commented Jul 28, 2022

underlying/related issue in tar haskell/tar#6

@Mikolaj
Copy link
Member

Mikolaj commented Jul 28, 2022

Thanks. And there is even some traffic in the tar issue, so let me downgrade priority on our side. Unless a workaround on cabal side is urgent for any users?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants