haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 697 forks source link

cabal update weirdness behind multilevel proxy #3403

Open joeyh opened 8 years ago

joeyh commented 8 years ago

In a McDonalds, cabal update failed the first time with "cabal: Codec.Compression.Zlib: premature end of compressed stream", but the second time it said "Local and remote files match" despite only having downloaded a prefix of the 00-index.tar.gz and not being able to install any packages.

https://tmp.kitenet.net/cabal/ has the files download and a cabal -v3 log and curl -v log.

<dcoutts> joeyh: so you've got two additional proxies compared to me
<dcoutts> a varnish one and a localhost squid one
<dcoutts> the first proxy is our CDN, and you've got two others you're behind
<dcoutts> for a total of 3
<joeyh> neither of those proxies are on my machine, it's the network here I suppose
<joeyh> I got a good update using a VPN
<dcoutts> hmm, and they only speak HTTP 1.0
<dcoutts> so my response here is HTTP 1.1
<dcoutts> but yours is HTTP 1.0

Also got the codec error on download of some packages from hackage. This left the cached and corrupt package tarballs in .cabal and prevented cabal install from installing them even after I got to a good network.

cabal-install version 1.22.6.0 using version 1.22.5.0 of the Cabal library

joeyh commented 8 years ago

Upgraded cabal and reproduced the cabal update problem with the new one.

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

23Skidoo commented 8 years ago

Thanks for providing test files and logs.

carlostome commented 7 years ago

I recently run into the same problem by using a shitty 3G internet connection. Here is the log:

$ cabal update
Config file path source is default config file.
Config file /home/carlos/.cabal/config not found.
Writing default configuration to /home/carlos/.cabal/config
Downloading the latest package list from hackage.haskell.org
Codec.Compression.Zlib: compressed data stream format error (incorrect data
check)

$ cabal update
Downloading the latest package list from hackage.haskell.org
Skipping download: local and remote files match.

$ cat .cabal/packages/hackage.haskell.org/00-index.tar.gz.etag
"225056991d2ff821d9eeeb05d7247028"%

$ md5sum .cabal/packages/hackage.haskell.org/00-index.tar.gz
ae3a5f7566882cec3ab7738e98fe705c  .cabal/packages/hackage.haskell.org/00-index.tar.gz

00-index.tar.gz

The problem is that in the presence of an error cabal leaves the index in an inconsistent state where the etag does not match the downloaded tarball checksum.

I guess a solution would be to check that the etag actually matches the index checksum before not redownloading the index.

I'm using: cabal-install version 1.24.0.2 compiled using version 1.24.2.0 of the Cabal library

[Edit] Added cabal version.