Re: XML test error on Arch Linux

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Frank Streitzig <fstreitzig(at)gmx(dot)net>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: XML test error on Arch Linux
Date: 2024-07-06 18:24:35
Message-ID: 54124c04-1b08-4f7e-8a22-a41a718f7ae5@ewie.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024-07-06 16:25 +0200, Tom Lane wrote:
> Erik Wienhold <ewie(at)ewie(dot)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

Attachment Content-Type Size
libxml2.13-fixes.patch text/x-diff 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-07-06 18:43:22 Re: XML test error on Arch Linux
Previous Message Andrey M. Borodin 2024-07-06 17:36:17 Re: Add LSN <-> time conversion functionality