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

fix zstd decompressor since initrd has no content size header #12

Closed
wants to merge 1 commit into from

Conversation

Jannik2099
Copy link
Contributor

It seems the kernel image and/or initrd may not include content size when compressed with zstd - switch to the zstd stream reader and read in chunks of 1MB until EOF

See the section above https://pypi.org/project/zstandard/ - Stream Reader API for details

@codecov-io
Copy link

Codecov Report

Merging #12 into master will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #12   +/-   ##
=======================================
  Coverage   84.42%   84.42%           
=======================================
  Files          16       16           
  Lines         745      745           
=======================================
  Hits          629      629           
  Misses        116      116           
Impacted Files Coverage Δ
ecleankernel/file.py 91.81% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93f109e...085bc69. Read the comment docs.

@@ -123,7 +123,8 @@ def decompress_raw(self) -> bytes:
# Technically a redundant import, this is just
# to make your IDE happy :)
import zstandard
return zstandard.ZstdDecompressor().decompress(f.read())
return zstandard.ZstdDecompressor().decompress(
f.read(), 200*1024*1024)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this 200M, though?

@Jannik2099
Copy link
Contributor Author

yes, yes it is - somehow managed to pick the wrong commit, don't rebase at night!
Will fix in a few minutes

Copy link
Member

@mgorny mgorny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, I've missed your update and I have completely forgotten about this. Could you take a look at this last comment. I'll be happy to merge it afterwards.

ecleankernel/file.py Outdated Show resolved Hide resolved
Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants