[Haskell-cafe] workarounds for Codec.Compression.Zlib errors in darcs

Eric Kow kowey at darcs.net
Wed Nov 26 09:38:33 EST 2008


Hi everybody,

This advisory is for people who have installed darcs 2.1.2 via the
Cabal build method.  As you may have noticed, the cabalised darcs
sometimes fails with errors like

  Codec.Compression.Zlib: incorrect data check

Why this happens
----------------
Older versions of darcs can to produce gzipped files with broken CRCs.
We never noticed this because our homegrown wrapper around the C libz
library does not pick up these errors.  Lately, we have been working on
adopting the Haskell zlib wrapper, which is made available by default in
darcs.cabal.  This new wrapper is more stringent and fails when it
encounters these files.

Workaround 1 : use C libz instead of Haskell zlib
-------------------------------------------------
So how can you work around these errors?  If you are building darcs on
any Unix-y operating system (e.g. Linux or MacOS X), you can cabal
configure darcs to use the old C libz binding:

  cabal configure -f external-zlib

This will restore our homegrown wrapper which ignores the broken CRCs
(note that the darcs head no longer *produces* these broken files,
thanks to debugging by Matthias Andree and to a bugfix by David Roundy;
http://bugs.darcs.net/issue844 for details).

In principle, the same advice applies for Windows users, with more
details hopefully to follow on how the C libz in a GHC-accesible
location.  Details to follow.  In the meantime, you can either build
darcs using the old configure and make technique (assuming you have
MSYS and related tools), or use a binary that does not use the Haskell
zlib wrapper (for example, by downgrading to
http://www.haskell.org/~simonmar/darcs-2.0.2+75.zip )

Workaround 2 : fix your broken gzipped files
--------------------------------------------
If you have control over the repositories with broken gzipped files, it
should be possible to repair these files by gunzipping them and then
redo-ing the gzip.  We think that the attached script should help.
Please report back if this is not the case.

How we will fix this problem in the long term
---------------------------------------------
I'm very sorry for the grief this has caused.  To begin with, we will
ensure that the 2.2 release gets more testing before releasing it in
January.

It will also handle these broken CRCs more gracefully.  Our plan is to
 - either extend darcs repair or provide a Haskell script to fix
   these broken files
 - detect the broken files and advise users to run darcs repair (or the
   script) as needed
 - somewhere in the future, disallow broken CRC files whilst still
   advising users on how to fix their files.

Many thanks!

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20081126/9ff3c2aa/attachment.bin


More information about the Haskell-Cafe mailing list