Re: XML test error on Arch Linux

Erik Wienhold <ewie@ewie.name>

From: Erik Wienhold <ewie@ewie.name>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Frank Streitzig <fstreitzig@gmx.net>, pgsql-hackers@lists.postgresql.org
Date: 2024-07-06T18:24:35Z
Lists: pgsql-hackers

Attachments

On 2024-07-06 16:25 +0200, Tom Lane wrote:
> Erik Wienhold <ewie@ewie.name> writes:
> > So, there must be breaking changes in 2.13.0:
> > https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.13.0
> 
> Yeah, apparently --- I get what look like the same diffs with
> libxml2 2.13.0 recently supplied by MacPorts.  Grumble.
> Somebody's going to have to look into that.

Here's a patch that fixes just the xmlserialize and namespace errors.

Use xmlAddChildList instead of xmlAddChild for xmlserialize.  That also
works with 2.12.7, but I don't know about older libxml2 versions.  Maybe
add a version check to be safe:

    #if LIBXML_VERSION >= 21300
                xmlAddChildList(root, content_nodes);
    #else
                xmlAddChild(root, content_nodes);
    #endif

I don't know if using xmlAddChild in this context was ever correct.

The namespace errors are tricky because xmlParseBalancedChunkMemory now
returns res_code != 0 for invalid or unknown namespaces (probably other
errors as well).  So I just added an additional check to ignore those
errors for >=2.13.  But that's rather hackish.  I don't know how to
handle it in xml_errorHandler where those error codes are already dealt
with in order to compensate for differences in error reporting across
different libxml2 versions.  Looks like xmlerrcxt is ignored by
xmlParseBalancedChunkMemory.

No idea how to deal with the remaining errors for invalid and undefined
entities which appear to include less details now.  That seems to be
expected, judging from the release notes:

> A few error messages were improved and consolidated. Please update
> downstream test suites accordingly.

How to deal with that in a manner that still works for pre-2.13, other
than filtering out those details that are no longer included in 2.13?
Or just  \set VERBOSITY terse  for those few test cases?  But that omits
the entire error detail.

-- 
Erik

Commits

  1. Make our back branches compatible with libxml2 2.13.x.

  2. Remove new XML test cases added by e7192486d.

  3. Suppress "chunk is not well balanced" errors from libxml2.

  4. Use xmlParseInNodeContext not xmlParseBalancedChunkMemory.

  5. Use xmlAddChildList not xmlAddChild in XMLSERIALIZE.