Segmentation fault

Issue #1 resolved
tymmym
created an issue

Got "Segmentation fault" error message when run example from haddock documentation:

{{{ import System.Environment (getArgs) import Codec.Archive.LibZip

main = do (zipfile:file:_) <- getArgs bytes <- withArchive [] zipfile $ fileContents [] file putStrLn bytes }}}

LibZip-0.2.0.4, bindings-libzip-0.1.0.4, ghc 7.0.4, libzip 0.10

Comments (4)

  1. Sergey Astanin repo owner

    I have the same versions except for ghc (ghc 7.0.3 in my case), and this example builds and executes correctly. I build it like this:

    ghc --make libzip-issue-1.hs
    

    and execute like

    $ ./libzip-issue-1 path/to/archive.zip path/to/file/within/archive.txt
    

    If you run the script without arguments, it should fail with an error like this one, but not a segmentation fault:

    libzip-issue-1: user error (Pattern match failure in do expression at libzip-issue-1.hs:5:3-18)
    

    What OS do you use? How do you build and run the script? Does it happen on a particular zip archive or on just anything? If yes, please attach an example of such an archive or communicate it to me privately.

  2. Sergey Astanin repo owner

    I've noticed that libzip 0.10 has changed API with respect to 0.9. This might be an issue as it is not binary compatible (different structures' layout, different integer types used). I'll try to update bindings-libzip and LibZip for libzip == 0.10.

  3. Sergey Astanin repo owner
    • changed status to open

    Dear @tymmym,

    I've updated bindings to be compatible with libzip-0.10. In fact, it has changed some data structures, and is now using different integer types. Probably this is the reason of the segfault. What's strange, the old version still works for me (is it the effect of x86_64 and some coincidence, I don't know).

    Please upgrade to LibZip-0.10 (available on Hackage and tagged in this repository) and let me know if the problem is resolved. The interface of the library has changed. You may need to make sure you supply 'Integer' values instead of 'Int's, and 'numFiles' takes an additional parameter. For details see 86380ecbc8d9

  4. Log in to comment