Skip to content

Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility - #2391

Merged
jan-cerny merged 1 commit into
OpenSCAP:mainfrom
Mab879:backport_python2_patch
Sep 3, 2026
Merged

Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility#2391
jan-cerny merged 1 commit into
OpenSCAP:mainfrom
Mab879:backport_python2_patch

Conversation

@Mab879

@Mab879 Mab879 commented Jul 28, 2026

Copy link
Copy Markdown
Member

@Mab879 Mab879 added this to the 1.4.5 milestone Jul 28, 2026
@jan-cerny jan-cerny self-assigned this Aug 10, 2026
Comment thread swig/openscap.i Outdated
Comment on lines +51 to +52
else if (PyLong_Check($input))
$1 = (time_t) PyLong_AsLong($input);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the same as the previous branch.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Can you please elaborate, this is (now) rebased on latest main so this shouldn't be the case?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The if condition and statement is the same as the else if condition and statement. The else if is superflous and lines 51-52 should be removed.

    if (PyLong_Check($input))
        $1 = (time_t) PyLong_AsLong($input);
    else if (PyLong_Check($input))
        $1 = (time_t) PyLong_AsLong($input);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated. Please take a look.

@Mab879
Mab879 force-pushed the backport_python2_patch branch from a9dfc2c to b2168a9 Compare August 12, 2026 15:21
@Mab879
Mab879 requested a review from jan-cerny August 12, 2026 15:21
@Mab879
Mab879 force-pushed the backport_python2_patch branch from b2168a9 to 5d723d1 Compare August 12, 2026 17:37
octo-sts-3 Bot pushed a commit to wolfi-dev/os that referenced this pull request Aug 28, 2026
…276475)

The explicit -DCMAKE_BUILD_TYPE=None suppressed the cmake pipeline's Release default, so NDEBUG was never defined and OpenSCAP's SEXP_VALIDATE debug assertion stayed compiled in. That assertion re-validates the entire collected-item list on every item append, making recursive file_object probes quadratic in file count: the GPOS STIG profile's /usr/lib ownership walk takes ~10 minutes on a 20k-file tree (20+ minutes on gitlab toolbox images) instead of ~1 second. Rebuilding with NDEBUG produces byte-identical per-rule scan results, verified by diffing XCCDF results of both builds against the same extracted rootfs.

Also fix a pre-existing FTBFS surfaced by rebuilding: swig >= 4.3 removed the Python 2 compat macros (PyInt_Check, PyInt_AsLong, PyString_AsString) that swig/openscap.i relies on. Backport the pending upstream fix (OpenSCAP/openscap#2391, itself a backport of Fedora's packaging fix) verbatim so the patch drops cleanly once it lands in a release.

Export:  c981b6d629fc68b5aa435c725023387aae288d9a
@havardAasen

Copy link
Copy Markdown
Contributor

Is this fix planned to be merged soon? This is starting to be a problem in most distros packaging this project.

Is there also a planned release date of 1.4.5? Which hopefully includes this fix.

@Mab879
Mab879 force-pushed the backport_python2_patch branch from 5d723d1 to 26b6cb1 Compare September 1, 2026 16:06
@sonarqubecloud

sonarqubecloud Bot commented Sep 1, 2026

Copy link
Copy Markdown

@jan-cerny

Copy link
Copy Markdown
Member

/packit build

1 similar comment
@jan-cerny

Copy link
Copy Markdown
Member

/packit build

@jan-cerny jan-cerny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The test fails on Fedora Rawhide aren't caused by the contents of this PR and will be fixed by #2410.

The fails of testing farm jobs are infrastructure problems (failed to setup the test environment) and aren't caused by the contents of this PR.

@jan-cerny
jan-cerny merged commit 4da1ff9 into OpenSCAP:main Sep 3, 2026
27 of 37 checks passed
@Mab879
Mab879 deleted the backport_python2_patch branch September 3, 2026 13:19
@jan-cerny

Copy link
Copy Markdown
Member

@havardAasen PR merged now. At this moment we don't have any specific plan for releasing the 1.4.5 version.

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