pacemaker/0001-Fix-libcrmcommon-Drop-deprecated-libxml2-symbols.patch
2023-11-21 10:01:56 +01:00

77 lines
2.7 KiB
Diff

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