* Tue Nov 21 2023 Klaus Wenninger <kwenning@redhat.com> - 2.1.7-0.2.rc1

- Fix build with libxml-2.12.0
This commit is contained in:
Klaus Wenninger 2023-11-21 10:01:56 +01:00
parent f327a3b395
commit 55a0d7bf51
3 changed files with 124 additions and 1 deletions

View File

@ -0,0 +1,76 @@
From 0bf0a0e44e9b7a980a4e45aa082e304415b4c4d1 Mon Sep 17 00:00:00 2001
From: Reid Wahl <nrwahl@protonmail.com>
Date: Tue, 21 Nov 2023 00:01:32 -0800
Subject: [PATCH] Fix: libcrmcommon: Drop deprecated libxml2 symbols
xmlLoadExtDtdDefaultValue should be replaced by the XML_PARSE_DTDLOAD
parser option. However, we don't call any function that accepts parser
options where we currently use xmlLoadExtDtdDefaultValue. We also don't
use an xmlParserCtxt, so we can't call xmlCtxtUseOptions(). (There's no
analog for xmlRelaxNGParserCtxt.)
xmlSubstituteEntitiesDefault() should be replaced by XML_PARSE_NOENT.
Similarly, we don't call any function that accepts parser options where
we currently use xmlSubstituteEntitiesDefault().
xmlLineNumbersDefault() is always enabled by the modern parser API.
xmlParseFile() should be replaced by xmlReadFile(). Here we use a NULL
encoding and no options.
Note that the "new" or "modern" libxml2 parser API was released over 20
years ago, and we already use it in other places. So backwards
compatibility should not be a concern.
No regression tests change.
Ref T719
Ref CLBZ#5530
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
---
lib/common/schemas.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/lib/common/schemas.c b/lib/common/schemas.c
index 53c21f168..7b91f71bb 100644
--- a/lib/common/schemas.c
+++ b/lib/common/schemas.c
@@ -445,7 +445,6 @@ validate_with_relaxng(xmlDocPtr doc, xmlRelaxNGValidityErrorFunc error_handler,
crm_debug("Creating RNG parser context");
ctx = calloc(1, sizeof(relaxng_ctx_cache_t));
- xmlLoadExtDtdDefaultValue = 1;
ctx->parser = xmlRelaxNGNewParserCtxt(relaxng_file);
CRM_CHECK(ctx->parser != NULL, goto cleanup);
@@ -482,7 +481,6 @@ validate_with_relaxng(xmlDocPtr doc, xmlRelaxNGValidityErrorFunc error_handler,
}
}
- xmlLineNumbersDefault(1);
rc = xmlRelaxNGValidateDoc(ctx->valid, doc);
if (rc > 0) {
valid = FALSE;
@@ -660,7 +658,7 @@ validate_xml_verbose(const xmlNode *xml_blob)
dump_file(filename);
- doc = xmlParseFile(filename);
+ doc = xmlReadFile(filename, NULL, 0);
xml = xmlDocGetRootElement(doc);
rc = validate_xml(xml, NULL, FALSE);
free_xml(xml);
@@ -866,9 +864,6 @@ apply_transformation(xmlNode *xml, const char *transform, gboolean to_logs)
xform = pcmk__xml_artefact_path(pcmk__xml_artefact_ns_legacy_xslt,
transform);
- xmlLoadExtDtdDefaultValue = 1;
- xmlSubstituteEntitiesDefault(1);
-
/* for capturing, e.g., what's emitted via <xsl:message> */
if (to_logs) {
xsltSetGenericErrorFunc(NULL, cib_upgrade_err);
--
2.39.3

View File

@ -0,0 +1,41 @@
From 8fcef5d3d041f53503444cdffc04344dbba7710c Mon Sep 17 00:00:00 2001
From: Reid Wahl <nrwahl@protonmail.com>
Date: Tue, 21 Nov 2023 00:26:42 -0800
Subject: [PATCH] Fix: libcrmcommon: Use const for xmlCtxtGetLastError()
Libxml v2.12 makes xmlCtxtGetLastError() return a const value. We get a
compiler warning if we assign it to a non-const object.
Fixes T719
Fixes CLBZ#5530
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
---
lib/common/xml.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/common/xml.c b/lib/common/xml.c
index 272d09241..53ebff770 100644
--- a/lib/common/xml.c
+++ b/lib/common/xml.c
@@ -802,7 +802,7 @@ string2xml(const char *input)
xmlNode *xml = NULL;
xmlDocPtr output = NULL;
xmlParserCtxtPtr ctxt = NULL;
- xmlErrorPtr last_error = NULL;
+ const xmlError *last_error = NULL;
if (input == NULL) {
crm_err("Can't parse NULL input");
@@ -993,7 +993,7 @@ filename2xml(const char *filename)
xmlDocPtr output = NULL;
bool uncompressed = true;
xmlParserCtxtPtr ctxt = NULL;
- xmlErrorPtr last_error = NULL;
+ const xmlError *last_error = NULL;
/* create a parser context */
ctxt = xmlNewParserCtxt();
--
2.39.3

View File

@ -41,7 +41,7 @@
## can be incremented to build packages reliably considered "newer"
## than previously built packages with the same pcmkversion)
%global pcmkversion 2.1.7
%global specversion 1.rc1
%global specversion 2.rc1
## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build
%global commit d0ef74d6431339f2f5782ab9061fa31734f4869c
@ -217,6 +217,9 @@ Source1: https://codeload.github.com/%{github_owner}/%{nagios_name}/tar.gz
Source2: pacemaker.sysusers
# upstream commits
Patch0: 0001-Fix-libcrmcommon-Drop-deprecated-libxml2-symbols.patch
Patch1: 0002-Fix-libcrmcommon-Use-const-for-xmlCtxtGetLastError.patch
Requires: resource-agents
Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release}
Requires: %{name}-cluster-libs%{?_isa} = %{version}-%{release}
@ -848,6 +851,9 @@ exit 0
%license %{nagios_name}-%{nagios_hash}/COPYING
%changelog
* Tue Nov 21 2023 Klaus Wenninger <kwenning@redhat.com> - 2.1.7-0.2.rc1
- Fix build with libxml-2.12.0
* Fri Nov 3 2023 Klaus Wenninger <kwenning@redhat.com> - 2.1.7-0.1.rc1
- Update for new upstream tarball for release candidate: Pacemaker-2.1.7-rc1,
for full details, see included ChangeLog file or