jgm/zip-archive

Compile failure for pre-AMP GHCs

Closed this issue · 1 comments

hvr commented
[1 of 1] Compiling Codec.Archive.Zip ( src/Codec/Archive/Zip.hs, /tmp/zip-archive-0.3.1.1/dist-newstyle/build/x86_64-linux/ghc-7.4.2/zip-archive-0.3.1.1/build/Codec/Archive/Zip.o )

src/Codec/Archive/Zip.hs:265:36:
    Not in scope: `<$>'
    Perhaps you meant one of these:
      `</>' (imported from System.FilePath),
      `<.>' (imported from System.FilePath)

This broke several install plans for pandoc (specifically, cabal install pandoc on GHC 7.6 would run into a build-failure), as can be seen in the build-matrix screenshot below (the dark red cells for GHC 7.6 and 7.4).

broken-installplans

After a bit of investigation I was able to track this down do the change below in the latest release, which had the effect of rendering install-plans with binary < 0.6 and base < 4.8 unsound:

--- a/src/Codec/Archive/Zip.hs
+++ b/src/Codec/Archive/Zip.hs
@@ -262,7 +262,7 @@ readEntry opts path = do
                     _         -> p)
   contents <- if isDir
                  then return B.empty
-                 else B.readFile path
+                 else B.fromStrict <$> S.readFile path
 #if MIN_VERSION_directory(1,2,0)
   modEpochTime <- fmap (floor . utcTimeToPOSIXSeconds)
                    $ getModificationTime path

where a use of <$> was added in a scope where it's not guaranteed that <$> is visible.

I've already fixed up the meta-data at https://hackage.haskell.org/package/zip-archive-0.3.1.1/revisions/ accordingly; so there's no immediate need for a new release of zip-archive, but please make sure the next release either restores compatibility with pre-AMP base or includes a tighter lower bound on binary, so this doesn't regress again.

jgm commented

Thanks.