Giter Club home page Giter Club logo

Comments (4)

paolobarbolini avatar paolobarbolini commented on June 14, 2024

Hello, speaking for the bzip2-rs crate the issue is that this file is a multistream bzip2 file, which we don't support yet. You can verify that by putting a println here and you'll see the end-of-stream is reached even though we didn't reach the end-of-file.

from bzip2-rs.

ygyzys avatar ygyzys commented on June 14, 2024

@paolobarbolini Hello, thanks for reply. I want to add it to bzip2-rs, but it seems to be a breaking change. In my view, we should remove ReadState::Eof entirely, since Decoder can never know that the end of file happened (it can only know that the end of block happened). Instead, DecoderReader should check for the end of file in the original stream (which it doesn't do now, and actually it seems to me that it can get stuck in infinite loop of feeding zero bytes to Decoder on some corrupted files which contain the header but end abruptly).

In any case, I'm more interested in pure Rust crate, so I suggest to create an issue there and continue our discussion of this there if possible.

And btw, I found a place where it is handled in the reference implementation: https://gitlab.com/federicomenaquintero/bzip2/-/blob/master/bzip2.c#L455 If you change this line to unconditional break;, bzip2 starts to give identical result to these crates.

from bzip2-rs.

paolobarbolini avatar paolobarbolini commented on June 14, 2024

I opened an issue over at my repo paolobarbolini/bzip2-rs#5 @ygyzys.

from bzip2-rs.

ygyzys avatar ygyzys commented on June 14, 2024

OK, and I'll close the issue here, because I missed that there is a MultiBzDecoder class in this crate. A bit confusing though: I don't see any reason why this should be a separate class from BzDecoder, since its functionality is strictly superior, and performance overhead for checking the end of block is hardly an issue.

from bzip2-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.