Re: Use \if/\endif to remove non-libxml2 expected output in regression tests

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Daniel Gustafsson <daniel(at)yesql(dot)se>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use \if/\endif to remove non-libxml2 expected output in regression tests
Date: 2026-06-12 23:21:28
Message-ID: 1767619.1781306488@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> It's kind of sad that this issue is still present in the wild ten
> years later. But anyway, I wonder if we could dodge the issue
> simply by modifying these error-provoking cases to have some
> whitespace at the end of the XML input? I don't think I have
> a problematic version of libxml2 to test that with, though.

Hah, this idea does mostly work. Finding that no system I had at
hand had a libxml2 old enough to exhibit the problem, I installed
libxml2 2.9.3 from source. (That's the first version containing
the problematic CVE fix, and it does behave as xml_2.out expects.)
I found that four of the inconsistent messages could be fixed this
way. The other three problem cases have input like '<wrong' or
all-spaces, and evidently we need the error to be recognized before
reaching end-of-input.

Now, it seems to me that we are not especially interested in whether
libxml2 produces one error message or another one for given input;
what we need to test is only that Postgres reports the error
properly. So I don't have a problem with tweaking those bad inputs
a bit more aggressively to make them be something that different
libxml2 versions will report identically. The result of my
experiments is attached: it results in expected/xml.out that matches
the output of both 2.9.3 and recent versions. So if we do this
we could drop xml_2.out.

This patch is WIP because I've not updated xml_1.out to match.
But that's trivial, and dropping xml_2.out is equally boring,
so I left those parts out of this demo patch.

regards, tom lane

Attachment Content-Type Size
unify-libxml-error-results-wip.patch text/x-diff 6.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2026-06-12 23:21:42 Re: Improve pg_stat_statements scalability
Previous Message Baji Shaik 2026-06-12 22:50:18 [PATCH] COPY TO FORMAT json: respect column list order