Skip to content

fix: build against libxml2 2.12 and later - #65

Merged
nic-6443 merged 1 commit into
mainfrom
fix/libxml2-const-error-handler
Oct 22, 2026
Merged

nic-6443 merged 1 commit into
mainfrom
fix/libxml2-const-error-handler

Conversation

@jarvis9443

@jarvis9443 jarvis9443 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

src/saml.c doesn't compile against libxml2 2.12 or later. 2.12 changed xmlStructuredErrorFunc to take a const xmlError *, so passing ingoreStructuredError to xmlSetStructuredErrorFunc now trips -Wincompatible-pointer-types, and the Makefile builds with -Werror:

src/saml.c:126:37: error: passing argument 2 of 'xmlSetStructuredErrorFunc' from incompatible pointer type [-Wincompatible-pointer-types]

Ubuntu 26.04 ships libxml2 2.15 and is what ubuntu-latest GitHub runners are moving to, so luarocks install lua-resty-saml (and anything depending on it, such as make deps in apache/apisix) fails there.

The handler now picks its signature by LIBXML_VERSION: const xmlError * from 2.12 on, the old one before. No warnings are silenced. The handler body is empty, so behaviour doesn't change.

Checked that make build (with -Werror) succeeds and t/signed-response.t passes on Ubuntu 24.04 (libxml2 2.9.14) and Ubuntu 26.04 (libxml2 2.15.2).

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility with newer and older versions of the XML library.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 9f4b3aad-2bbe-4e06-aa77-23dac22068fe
📥 Commits

Reviewing files that changed from the base of the PR and between ea73ee1 and 44495ed.

📒 Files selected for processing: 1
  • src/saml.c

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

📝 Walkthrough

The error-handler parameter type now depends on the libxml2 version. It is const for version 2.12 or later and mutable for earlier versions.

Changes: libxml2 Compatibility

Layer / File(s) Summary
Version-dependent error-handler signature
src/saml.c
ingoreStructuredError uses a const xmlError* parameter with libxml2 2.12 or later and an xmlError* parameter with earlier versions.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 44495

The callback signature matches libxml2 across the 2.12 transition, so no merge-blocking risk remains.

Pre-merge checks: Passed 6
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: fixing the build for libxml2 2.12 and later.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
E2e Test Quality Review Passed The change is limited to the libxml2 callback signature in src/saml.c. LIBXML_VERSION selects const xmlError* for 2.12+ and preserves the older signature. The existing CI runs make test, which…
Security Check Passed No security issues found. The pull request only changes the static libxml2 error-callback parameter type in src/saml.c:44-49. The callback ignores its arguments and does not log, serialize, persist, a…
Full details: E2e Test Quality Review

Explanation

The change is limited to the libxml2 callback signature in src/saml.c. LIBXML_VERSION selects const xmlError* for 2.12+ and preserves the older signature. The existing CI runs make test, which builds with -Wall -Werror and runs the real OpenResty/Lua/XMLSec E2E suite through prove -r t/. No new return value, shared state, mock, assertion, or unrelated logic was introduced.

Full details: Security Check

Explanation

No security issues found. The pull request only changes the static libxml2 error-callback parameter type in src/saml.c:44-49. The callback ignores its arguments and does not log, serialize, persist, authorize, access resources, configure TLS, or resolve secrets. Categories 1-7: No issues found.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@nic-6443
nic-6443 merged commit 685d6d7 into main Oct 22, 2026
2 checks passed
@jarvis9443 jarvis9443 mentioned this pull request Oct 22, 2026
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.

2 participants