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

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
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
Member

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

@rrnewton
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)
@mietek
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
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?

@mietek
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

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

@kmels
kmels commented Jul 1, 2014

This is how it can be fixed I think:

trofi/quickcheck@ccf15ee

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

@saturday06

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

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

@23Skidoo
Member

Fixed by #2006.

@23Skidoo 23Skidoo closed this Jul 21, 2014
@kdkeyser
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
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
ghost commented Oct 6, 2014

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

@fujiyan
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
Contributor
nh2 commented Oct 30, 2014

This would be useful to have released.

@donatello

👍 good to have released.

@nh2 nh2 referenced this issue in google/pull-request-mailer Dec 11, 2014
Open

hGetContents: invalid argument (invalid byte sequence) #22

@mietek
Contributor
mietek commented Jan 24, 2015

Halcyon includes a workaround for this issue.

@hoosierEE

@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"
@jystic jystic referenced this issue in jystic/unix-compat Jun 28, 2015
Open

0.4.1.4: Build failures on multiple systems #17

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