You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ch...@apache.org on 2026/05/04 03:38:59 UTC

(cloudberry) 20/26: Fix incompatibilities with libxml2 >= 2.12.0.

This is an automated email from the ASF dual-hosted git repository.

oppenheimer01 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 027cf9001f00fadd60e90df19d3473311dedd57b
Author: Tom Lane <tg...@sss.pgh.pa.us>
AuthorDate: Mon Jan 29 12:06:07 2024 -0500

    Fix incompatibilities with libxml2 >= 2.12.0.
    
    libxml2 changed the required signature of error handler callbacks
    to make the passed xmlError struct "const".  This is causing build
    failures on buildfarm member caiman, and no doubt will start showing
    up in the field quite soon.  Add a version check to adjust the
    declaration of xml_errorHandler() according to LIBXML_VERSION.
    
    2.12.x also produces deprecation warnings for contrib/xml2/xpath.c's
    assignment to xmlLoadExtDtdDefaultValue.  I see no good reason for
    that to still be there, seeing that we disabled external DTDs (at a
    lower level) years ago for security reasons.  Let's just remove it.
    
    Back-patch to all supported branches, since they might all get built
    with newer libxml2 once it gets a bit more popular.  (The back
    branches produce another deprecation warning about xpath.c's use of
    xmlSubstituteEntitiesDefault().  We ought to consider whether to
    back-patch all or part of commit 65c5864d7 to silence that.  It's
    less urgent though, since it won't break the buildfarm.)
    
    Discussion: https://postgr.es/m/1389505.1706382262@sss.pgh.pa.us
---
 contrib/xml2/xpath.c        | 2 ++
 src/backend/utils/adt/xml.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c
index 212cb74aa22..f1f8b732f80 100644
--- a/contrib/xml2/xpath.c
+++ b/contrib/xml2/xpath.c
@@ -74,6 +74,8 @@ pgxml_parser_init(PgXmlStrictness strictness)
 	/* Initialize libxml */
 	xmlInitParser();
 
+	xmlSubstituteEntitiesDefault(1);
+
 	return xmlerrcxt;
 }
 
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 1537adfb7bf..c97b98ac8eb 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -137,6 +137,8 @@ static void xml_errsave(Node *escontext, PgXmlErrorContext *errcxt,
 						int sqlcode, const char *msg);
 static void xml_errorHandler(void *data, PgXmlErrorPtr error);
 static int	errdetail_for_xml_code(int code);
+static void xml_ereport_by_code(int level, int sqlcode,
+								const char *msg, int errcode);
 static void chopStringInfoNewlines(StringInfo str);
 static void appendStringInfoLineSeparator(StringInfo str);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org