Skip to content

createrepo_c zstd compression doesn't fill in the content size, in the frame header. Python API problems. #415

@james-antill

Description

@james-antill

createrepo_c zstd compression doesn't fill in the content size, in the frame header. This means that you can't call the python API to decompress in the simple/usable way:

data = zstandard.decompress(zstd_data)

...because you'll get an exception:

  File "/usr/lib64/python3.11/site-packages/zstandard/__init__.py", line 210, in decompress
    return dctx.decompress(data, max_output_size=max_output_size)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
zstd.ZstdError: could not determine content size in frame header

...the only way to workaround this is to guess at the output size and pass that random number to the decompress API call.

See the documentation on the python API, esp. the 7th paragraph, here: https://python-zstandard.readthedocs.io/en/latest/decompressor.html#zstandard.ZstdDecompressor.decompress

...a simple testcase would be to generate a compressed file and then call zstandard.decompress() from the std. python API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TriagedSomeone on the DNF team has read the issue and determined the next steps to take

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions