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 install - Codec.Compression.Zlib: incorrect header check #678

Closed
bos opened this issue May 24, 2012 · 10 comments
Closed

cabal install - Codec.Compression.Zlib: incorrect header check #678

bos opened this issue May 24, 2012 · 10 comments

Comments

@bos
Copy link
Contributor

bos commented May 24, 2012

(Imported from Trac #686, reported by Monsikos on 2010-05-10)

The command "cabal install packagename" fails with : "Codec.Compression.Zlib: incorret header check".

The message appears while trying to extract the tar.gz file.

I have manually updated Cabal (1.8.0.2), cabal-install(0.8.2) and zlib(0.5.2.0) but the error remains.

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by @dcoutts on 2010-05-10)

Are you absolutely sure that you are running cabal-install version 0.8.2? Does running cabal --version report the expected version? I ask because it is unfortunately all too easy to accidentally get into the situation where there are two versions of cabal-install installed and the first one on the Windows %PATH% is often the older one.

If you are definitely running version 0.8.2, does this happen for all packages or just some? Does trying to unpack the .tar.gz package manually (eg using tar command line, or WinZip?) fail too? BTW, you can see where cabal is getting the .tar.gz file from, just run with the -v flag and look for the line where it mentions extracting (which is presumably also where it'll fail).

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by Monsikos on 2010-05-11)

After running "cabal --version" I confirm that I'm using the 0.8.2 version.

I think it happens for all packages as every package I tried to install gave the same "incorrect header check" error.

I unpacked the .tar.gz manually successfully and then installed the package manually with the "runghc Setup ..." commands. It works this way.

Here is what I get when I run "cabal install binary-search -v" for example
C:\Users\Paul>cabal install binary-search  -v
C:\Program Files\Haskell Platform\2010.1.0.0\bin\ghc.exe --numeric-version
looking for package tool: ghc-pkg near compiler in C:\Program Files\Haskell
Platform\2010.1.0.0\bin
found package tool in C:\Program Files\Haskell
Platform\2010.1.0.0\bin\ghc-pkg.exe
C:\Program Files\Haskell Platform\2010.1.0.0\bin\ghc-pkg.exe --version
C:\Program Files\Haskell Platform\2010.1.0.0\bin\ghc.exe --supported-languages
Reading installed packages...
C:\Program Files\Haskell Platform\2010.1.0.0\bin\ghc-pkg.exe dump --global
C:\Program Files\Haskell Platform\2010.1.0.0\bin\ghc-pkg.exe dump --user
Reading available packages...
Resolving dependencies...
selecting binary-search-0.0 (hackage)
selecting base-3.0.3.2 (installed) and 4.2.0.0 (installed) and discarding
syb-0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.2 and 0.2.1
selecting ffi-1.0 (installed)
selecting ghc-prim-0.2.0.0 (installed)
selecting integer-gmp-0.2.0.0 (installed)
selecting rts-1.0 (installed)
selecting syb-0.1.0.2 (installed)
In order, the following would be installed:
binary-search-0.0 (new package)
Downloading binary-search-0.0...
Downloaded to
C:\Users\Paul\AppData\Roaming\cabal\packages\hackage.haskell.org\binary-search\
0.0\binary-search-0.0.tar.gz
Extracting
C:\Users\Paul\AppData\Roaming\cabal\packages\hackage.haskell.org\binary-search\
0.0\binary-search-0.0.tar.gz
to C:\Users\Paul\AppData\Local\Temp\binary-search-0.04196...
cabal: Codec.Compression.Zlib: incorrect header check

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by finlay on 2010-05-11)

Im having the same problem with cabal, both on cabal install and with cabal update.

The versions are all the same,
cabal-install version 0.8.2
using version 1.8.0.2 of the Cabal library
zlib-0.5.2.0.

I can't update because of the error. I notice that it downloads 00-index.tar.gz, but creates it as a POSIX tar archive, ie. it seems to automatically gunzip it. I think that is the problem.

Not sure how to proceed.

F

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by finlay on 2010-10-18)

After exploring this a bit more I have discovered that it is caused by secret ISP http proxy.

There is a header: Content-Encoding: x-gzip
that gets causes the file to be gunzipped before it gets to my computer. There are solutions:

1) patch cabal-install to not fail on files it expects to be gzipped but have been unzipped. I'll see if I can make a patch to do that. 2) make my ISP not proxy the http traffic (not very easy to do). 3) Remove the Content-Encoding: x-gzip header.

I have bumped the severity because this error stops me from using cabal, a basic part of the batteries included platform.

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by finlay on 2010-10-20)

Having slept on it, and after sending an email to the ISP asking to change their proxy settings, I also had a look at how things are set up on ubuntu packages:

 $ HEAD http://archive.ubuntu.com/.../haskell-cabal-install_0.8.0.orig.tar.gz
...
Content-Type: application/x-gzip
...
and
 $ HEAD http://hackage.haskell.org/packages/archive/00-index.tar.gz
...
Content-Encoding: x-gzip
Content-Type: application/x-tar
...
As you can see, the Content-Encoding header is not set on the ubuntu apache server when serving tar.gz files. I guess it would be sensible to not set it on the hackage server either. Note that this is the same problem described on #622.

I think the ISPs proxy settings are "wrong", but they are also common, and out of our control. BTW, the ISP is Telecom NZ, with millions of customers, so I don't expect to hear back from them any time soon.

Finlay

Also see: #540 #562 #572

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by adept on 2010-10-20)

Just for reference: this behavior could be recreated locally on linux box by installing "ziproxy" and specifying "MaxSize = 0" and "Gzip = false" in its config.

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by @dcoutts on 2010-10-27)

Applied. Now needs confirming. Monsikos, finlay, could you check?

Wed Oct 27 10:50:34 BST 2010  Duncan Coutts <duncan@haskell.org>
  * Add an extra note about the http proxy decompression issue
Tue Oct 26 22:26:06 BST 2010  Dmitry Astapov <dastapov@gmail.com>
  * Use "maybeDecompress" to handle broken proxies that transparenty decompress network streams.
  Closes #622, #686. Cabal update could fail in some cases, see http://trac.haskell.org/http/ticket/109283

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by @dcoutts on 2010-10-27)

Replying to @dcoutts:

Applied. Now needs confirming. Monsikos, finlay, could you check?

Note: needs latest darcs Cabal-1.10 branch and cabal-install HEAD branch:

darcs get http://darcs.haskell.org/cabal-branches/cabal-1.10

darcs get http://darcs.haskell.org/cabal-install

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by finlay on 2010-10-27)

Thanks Guys

I installed cabal-1.10, and the head of cabal-install.
Now, despite the fact that there is a broken ISP proxy unzipping files for me, cabal install and cabal update work fine. Yay!

See: the index is a tar file...

finlay@korora:~$ cabal --version
cabal-install version 0.9.5
using version 1.10.0.0 of the Cabal library
finlay@korora:~$ file .cabal/packages/hackage.haskell.org/00-index.tar.gz
.cabal/packages/hackage.haskell.org/00-index.tar.gz: POSIX tar archive (GNU)
Thanks again for your help.

@bos
Copy link
Contributor Author

bos commented May 24, 2012

(Imported comment by @kosmikus on 2010-11-02)

Looks like this one is actually fixed.

@bos bos closed this as completed May 24, 2012
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

1 participant