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

1.20 regression from 1.18 -- /tmp/pkgConf-unix-compat-0.4.164303.1: hGetContents: invalid argument (invalid byte sequence) #1883

Closed
parfunc opened this Issue May 20, 2014 · 19 comments

Comments

Projects
None yet
@parfunc

parfunc commented May 20, 2014

Under cabal 1.18.0, and GHC 7.8.2, installing unix-compat works fine. After cabal sandbox init, a cabal install unix-compat yields:

In-place registering unix-compat-0.4.1.1...
Installing library in
/nfs/nfs4/home/parfunc/temp/unix-compat/.cabal-sandbox/lib/x86_64-linux-ghc-7.8.2/unix-compat-0.4.1.1
Registering unix-compat-0.4.1.1...
Installed unix-compat-0.4.1.1

But under cabal 1.20.0 I get this:

In-place registering unix-compat-0.4.1.1...
Creating package registration file: /tmp/pkgConf-unix-compat-0.4.164303.1
Failed to install unix-compat-0.4.1.1
cabal: Error: some packages failed to install:
unix-compat-0.4.1.1 failed during the final install step. The exception was:
/tmp/pkgConf-unix-compat-0.4.164303.1: hGetContents: invalid argument (invalid
byte sequence)

This is happening on RHEL 6.5. I don't have the problem on Mac OS.

@parfunc

This comment has been minimized.

Show comment
Hide comment
@parfunc

parfunc May 20, 2014

FYI, the same error pops up for other people on a couple random pastes on the internet:

http://lpaste.net/report/102156
http://pastebin.com/6E3pm3Wy

parfunc commented May 20, 2014

FYI, the same error pops up for other people on a couple random pastes on the internet:

http://lpaste.net/report/102156
http://pastebin.com/6E3pm3Wy

@rrnewton

This comment has been minimized.

Show comment
Hide comment
@rrnewton

rrnewton May 20, 2014

Member

Oops -- this was me btw. I forgot to log out of our group account before posting.

Member

rrnewton commented May 20, 2014

Oops -- this was me btw. I forgot to log out of our group account before posting.

@rrnewton

This comment has been minimized.

Show comment
Hide comment
@rrnewton

rrnewton May 21, 2014

Member

Minor update: I observed this on the tf-random package as well:

In-place registering tf-random-0.5...
Creating package registration file: /tmp/pkgConf-tf-random-010702.5
Failed to install tf-random-0.5
cabal: Error: some packages failed to install:
tf-random-0.5 failed during the final install step. The exception was:
/tmp/pkgConf-tf-random-010702.5: hGetContents: invalid argument (invalid byte
sequence)
Member

rrnewton commented May 21, 2014

Minor update: I observed this on the tf-random package as well:

In-place registering tf-random-0.5...
Creating package registration file: /tmp/pkgConf-tf-random-010702.5
Failed to install tf-random-0.5
cabal: Error: some packages failed to install:
tf-random-0.5 failed during the final install step. The exception was:
/tmp/pkgConf-tf-random-010702.5: hGetContents: invalid argument (invalid byte
sequence)
@mietek

This comment has been minimized.

Show comment
Hide comment
@mietek

mietek May 26, 2014

Contributor

This is a locale-related error. Check that LANG is set to C.UTF-8, en_US.UTF-8, or another UTF-8 locale. Check that locale files are available on the system.

Contributor

mietek commented May 26, 2014

This is a locale-related error. Check that LANG is set to C.UTF-8, en_US.UTF-8, or another UTF-8 locale. Check that locale files are available on the system.

@rrnewton

This comment has been minimized.

Show comment
Hide comment
@rrnewton

rrnewton May 26, 2014

Member

Thanks! That worked fine. (I had LANG=C for some reason.) Any way to catch that exception and give something a bit more readable?

Member

rrnewton commented May 26, 2014

Thanks! That worked fine. (I had LANG=C for some reason.) Any way to catch that exception and give something a bit more readable?

@mietek

This comment has been minimized.

Show comment
Hide comment
@mietek

mietek May 26, 2014

Contributor

The best place to improve this would be the GHC standard library, as this is not a problem with Cabal itself.

Contributor

mietek commented May 26, 2014

The best place to improve this would be the GHC standard library, as this is not a problem with Cabal itself.

@wereHamster

This comment has been minimized.

Show comment
Hide comment
@wereHamster

wereHamster Jun 25, 2014

I had to set LANG=C.UTF-8 (use locale -a to see which ones are available on your system).

wereHamster commented Jun 25, 2014

I had to set LANG=C.UTF-8 (use locale -a to see which ones are available on your system).

@kmels

This comment has been minimized.

Show comment
Hide comment
@kmels

kmels Jul 1, 2014

This is how it can be fixed I think:

https://github.com/trofi/quickcheck/commit/ccf15ee45ee8a0e392b6bc6c68ac2b017a3ef701

I can send a pull request it if you point me at where the error is being triggered.

kmels commented Jul 1, 2014

This is how it can be fixed I think:

https://github.com/trofi/quickcheck/commit/ccf15ee45ee8a0e392b6bc6c68ac2b017a3ef701

I can send a pull request it if you point me at where the error is being triggered.

@saturday06

This comment has been minimized.

Show comment
Hide comment
@saturday06

saturday06 Jul 21, 2014

It causes when .cabal file contains byte sequence which doesn't compatible to system encoding. Accoring to users guide .cabal file must be writting in UTF-8. So we can fix it by reading .cabal file using UTF-8 explicitly.

saturday06 commented Jul 21, 2014

It causes when .cabal file contains byte sequence which doesn't compatible to system encoding. Accoring to users guide .cabal file must be writting in UTF-8. So we can fix it by reading .cabal file using UTF-8 explicitly.

@saturday06

This comment has been minimized.

Show comment
Hide comment
@saturday06

saturday06 Jul 21, 2014

I was mistaken. The cause is 'InstalledPackageInfo' file, not .cabal file. That is also written in UTF-8 and read by system encoding.

saturday06 commented Jul 21, 2014

I was mistaken. The cause is 'InstalledPackageInfo' file, not .cabal file. That is also written in UTF-8 and read by system encoding.

@23Skidoo

This comment has been minimized.

Show comment
Hide comment
@23Skidoo

23Skidoo Jul 21, 2014

Member

Fixed by #2006.

Member

23Skidoo commented Jul 21, 2014

Fixed by #2006.

@23Skidoo 23Skidoo closed this Jul 21, 2014

@kdkeyser

This comment has been minimized.

Show comment
Hide comment
@kdkeyser

kdkeyser Oct 1, 2014

Is the fix supposed to be included in cabal 1.20.0.2 / cabal-install 1.20.0.3? Because I still get this error while compiling thrift-1.0.0 from the Apache/Thrift repo:

cabal: Error: some packages failed to install: QuickCheck-2.7.6 depends on tf-random-0.5 which failed to install. tf-random-0.5 failed during the final install step. The exception was: /tmp/pkgConf-tf-random-01626.5: hGetContents: invalid argument (invalid byte sequence) thrift-1.0.0 depends on tf-random-0.5 which failed to install.

kdkeyser commented Oct 1, 2014

Is the fix supposed to be included in cabal 1.20.0.2 / cabal-install 1.20.0.3? Because I still get this error while compiling thrift-1.0.0 from the Apache/Thrift repo:

cabal: Error: some packages failed to install: QuickCheck-2.7.6 depends on tf-random-0.5 which failed to install. tf-random-0.5 failed during the final install step. The exception was: /tmp/pkgConf-tf-random-01626.5: hGetContents: invalid argument (invalid byte sequence) thrift-1.0.0 depends on tf-random-0.5 which failed to install.

@23Skidoo

This comment has been minimized.

Show comment
Hide comment
@23Skidoo

23Skidoo Oct 1, 2014

Member

@kdkeyser It looks like it's on the 1.20 branch, but not in any released version of cabal-install.

Member

23Skidoo commented Oct 1, 2014

@kdkeyser It looks like it's on the 1.20 branch, but not in any released version of cabal-install.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 6, 2014

When is the next release of cabal-install planned for?

ghost commented Oct 6, 2014

When is the next release of cabal-install planned for?

@fujiyan

This comment has been minimized.

Show comment
Hide comment
@fujiyan

fujiyan Oct 21, 2014

@kdkeyser If you have used a non-English version of Windows, you should change the console code page to UTF-8.
(I encountered same problem on a Japanese version of Windows(code page is MS932.))

chcp 65001
cabal install tf-random

But, i hope that tf-random will be able to install in ASCII code page.

fujiyan commented Oct 21, 2014

@kdkeyser If you have used a non-English version of Windows, you should change the console code page to UTF-8.
(I encountered same problem on a Japanese version of Windows(code page is MS932.))

chcp 65001
cabal install tf-random

But, i hope that tf-random will be able to install in ASCII code page.

@nh2

This comment has been minimized.

Show comment
Hide comment
@nh2

nh2 Oct 30, 2014

Member

This would be useful to have released.

Member

nh2 commented Oct 30, 2014

This would be useful to have released.

@donatello

This comment has been minimized.

Show comment
Hide comment
@donatello

donatello Nov 15, 2014

👍 good to have released.

donatello commented Nov 15, 2014

👍 good to have released.

@mietek

This comment has been minimized.

Show comment
Hide comment
@mietek

mietek Jan 24, 2015

Contributor

Halcyon includes a workaround for this issue.

Contributor

mietek commented Jan 24, 2015

Halcyon includes a workaround for this issue.

@hoosierEE

This comment has been minimized.

Show comment
Hide comment
@hoosierEE

hoosierEE Apr 2, 2015

@wereHamster - your comment pointed me in the right direction, thanks!

I was having the invalid argument (invalid byte sequence) issue with tf-random-0.5 on ARM, specifically:

$ uname -m
armv7l

...but after a quick google, the Arch wiki came to the rescue, as the following fixed it for me and I was able to install tf-random:

$ export LANG="C.UTF-8"

hoosierEE commented Apr 2, 2015

@wereHamster - your comment pointed me in the right direction, thanks!

I was having the invalid argument (invalid byte sequence) issue with tf-random-0.5 on ARM, specifically:

$ uname -m
armv7l

...but after a quick google, the Arch wiki came to the rescue, as the following fixed it for me and I was able to install tf-random:

$ export LANG="C.UTF-8"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment