Bug 31567

Summary: ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10504 returned by the lib, 10502 hardcoded in zstd headers, 10502 hardcoded in the cext)
Product: Mageia Reporter: Martin Liška <marxin.liska>
Component: RPM PackagesAssignee: David GEIGER <geiger.david68210>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Normal    
Version: Cauldron   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: python-zstd, python-zstandard CVE:
Status comment:

Description Martin Liška 2023-02-17 10:16:19 CET
Noticed that in Packit CI:
https://download.copr.fedorainfracloud.org/results/packit/rpm-software-management-rpmlint-1004/mageia-cauldron-x86_64/05533581-rpmlint/builder-live.log.gz

______________________ ERROR collecting test/test_pkg.py _______________________
ImportError while importing test module '/builddir/build/BUILD/rpmlint-2.4.0/test/test_pkg.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/site-packages/_pytest/python.py:608: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.10/site-packages/_pytest/pathlib.py:533: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
    exec(co, module.__dict__)
test/test_pkg.py:2: in <module>
    from rpmlint.pkg import parse_deps, rangeCompare
rpmlint/pkg.py:25: in <module>
    import zstandard as zstd
/usr/lib64/python3.10/site-packages/zstandard/__init__.py:39: in <module>
    from .backend_c import *  # type: ignore
E   ImportError: zstd C API versions mismatch; Python bindings were not compiled/linked against expected zstd version (10504 returned by the lib, 10502 hardcoded in zstd headers, 10502 hardcoded in the cext)
Comment 1 Martin Liška 2023-02-17 10:41:37 CET
Which is likely related to the Python package issue:
https://github.com/indygreg/python-zstandard/issues/190
Comment 2 Martin Liška 2023-02-17 13:53:08 CET
Note that if you run tests in the package build of 'python-zstandard', you would see the error message before shipping of the package.
Comment 3 David Walser 2023-02-17 17:34:08 CET
python-zstandard-0.19.0-2.mga9 and python-zstd-1.4.5.1-6.mga9 uploaded by David Geiger, which should fix this.  Please confirm and mark as RESOLVED FIXED.

Source RPM: zstd => python-zstd, python-zstandard
Assignee: bugsquad => geiger.david68210

Comment 4 Martin Liška 2023-02-20 09:55:30 CET
Thanks for the response. I've just re-run the PackIt builder and I still see the error:
https://download.copr.fedorainfracloud.org/results/packit/rpm-software-management-rpmlint-1006/mageia-cauldron-x86_64/05547258-rpmlint/builder-live.log.gz

I can see the mentioned python3-zstandard-0.19.0-2.mga9.x86_64 package is installed, but doesn't help.
Comment 5 Jani Välimaa 2023-02-20 20:04:12 CET
Upstream hardcodes zstd version to 1.5.2 ATM.

https://github.com/indygreg/python-zstandard/blob/0.19.0/c-ext/backend_c.c#L136

See also:

https://github.com/indygreg/python-zstandard/issues/190
Comment 6 David GEIGER 2023-02-21 07:07:38 CET
Should be fixed with latest 0.20.0 release:

- python3-zstandard-0.20.0-1.mga9
Comment 7 Martin Liška 2023-02-21 12:29:02 CET
Works for me, thanks!

Status: NEW => RESOLVED
Resolution: (none) => FIXED