Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xz decompressor #2851

Closed
daurnimator opened this issue Jul 8, 2019 · 15 comments
Closed

xz decompressor #2851

daurnimator opened this issue Jul 8, 2019 · 15 comments
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@daurnimator
Copy link
Contributor

xz is a lossless compression program and file format which incorporates the LZMA/LZMA2 compression algorithms.

Useful for:

Related to:

@andrewrk andrewrk added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library. labels Jul 8, 2019
@andrewrk andrewrk added this to the 0.6.0 milestone Jul 8, 2019
@shawnl
Copy link
Contributor

shawnl commented Aug 5, 2019

xz is a nice algorithm, but zstd got close while having many other use-cases for fast compression too. This is because zstd uses finite state entropy, which is quite new.

@daurnimator
Copy link
Contributor Author

Although zstd is preferred these days; we still need XZ to support e.g. compressed debug info https://sourceware.org/gdb/onlinedocs/gdb/MiniDebugInfo.html, unless gdb and other common utilities are changing any time soon?

@shawnl
Copy link
Contributor

shawnl commented Aug 6, 2019

@daurnimator note that LZMA is similar, but not the same as XZ (they are both supported by liblzma2). (LZMA was the beta version, that because become so widely used, the final version got a different name.)

I really don't see why we can't just build the C version, and use that.

@data-man
Copy link
Contributor

data-man commented Aug 9, 2019

lzma in ofelas/zigtest

@daurnimator
Copy link
Contributor Author

@ofelas would you like to make that into a PR to the standard library?

@shawnl
Copy link
Contributor

shawnl commented Sep 26, 2019 via email

@ofelas
Copy link

ofelas commented Oct 6, 2019

I added a LICENSE file (MIT) as the original Rust code has in case anyone wants to use said code.
Unfortunately, I have little or no time to spend on this at the moment.

@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Feb 10, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 30, 2020
@tetsuo-cpp
Copy link
Contributor

@daurnimator
Is this still something you want in the Zig standard library? I'm thinking of giving this a try.

I could either prepare and clean up the code linked above or write the implementation by hand using liblzma2 as a reference.

@alexpana
Copy link

alexpana commented Jan 4, 2021

@tetsuo-cpp I'm also willing to give this a try. Did you make any progress?

@tetsuo-cpp
Copy link
Contributor

tetsuo-cpp commented Jan 4, 2021

@alexpana
Sounds good! I haven't made any progress on this.
Feel free to ping me if you'd like another pair of eyes.

@b-ncMN
Copy link

b-ncMN commented Feb 5, 2021

Hi, I would like to give this a try, has some progress been made on that?

@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Jun 4, 2021
@andrewrk andrewrk modified the milestones: 0.9.0, 0.11.0 Nov 24, 2021
@andrewrk andrewrk modified the milestones: 0.12.0, 0.11.0 Jan 3, 2023
@matu3ba
Copy link
Contributor

matu3ba commented Jan 3, 2023

User squirl on discord:
"I'd like to mention that xz has some issues[1] - personally I'd recommend zstd instead, since it's more flexible, and tends to be faster for the same compression ratios [1]: https://lzip.nongnu.org/xz_inadequate.html

I'm not familiar with the details of zstd though so it may be too complex to include in std - in that case I'd recommend lzip, which is simpler and more efficient than xz, while also solving its reliability issues"

Main issue I see is that the reference implementation is GPLv2 and the public domain one "hopefully compliant" https://www.nongnu.org/lzip/pdlzip.html, which makes me wonder if the spec is ambiguous or if there are too few test cases etc.

@silversquirl
Copy link
Contributor

@matu3ba
Copy link
Contributor

matu3ba commented Jan 3, 2023

I dont think its useful to add all the compatibility boilerplate on top of lzip, if distros are switching to zstd https://en.wikipedia.org/wiki/XZ_Utils.

@silversquirl
Copy link
Contributor

Note that lzip uses LZMA, which @daurnimator mentions is needed anyway for parsing compressed debug info, so using lzip over zstd could provide a benefit in terms of code reuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. standard library This issue involves writing Zig code for the standard library.
Projects
Archived in project
Development

No branches or pull requests

10 participants