Erik Wienhold <e...@ewie.name> writes:
> So how about just ignoring XML_ERR_NOT_WELL_BALANCED like in the
> attached?

Oh, that's a good idea.  Given that we know they've changed the
behavior around this at least once, I'm not sure that it's safe
to unconditionally ignore this error --- but we could ignore it
as long as we've already recorded some libxml2 error.

I dug through the 2.13 sources and I think that in that version,
it is actually impossible to get XML_ERR_NOT_WELL_BALANCED without
any prior error.  It's only issued if parsing stops short of the
end of input, and that only happens if PARSER_STOPPED() becomes
true, and that only happens if xmlHaltParser() is called, and
all the calls to that seem to follow other errors being issued.
But the 2.12 code looks quite different and I'm not sure that
there's no such code path there; much less that it can't happen
in older versions.

> This also adds test cases for an unclosed tag because I
> wanted to see if I can trigger just "chunk is not well balanced", but
> without success.

No particular objection to adding these.

> But I'm not sure if that's really necessary if we already have:
>     <twoerrors>&idontexist;</unbalanced>
> The error messages are the same, except for the additional entity error.

I think the point of that test is different: it's showing that we
actually can report multiple errors out of a single libxml2 parsing
call.  Before seeing your message I was thinking we'd have to
"\set VERBOSITY terse" that test, which was annoying me mightily
because it could no longer prove any such thing.

I've updated indri's host to current MacPorts including libxml2
2.13.1, and as expected it's now showing failures:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=indri&dt=2024-07-09%2018%3A17%3A23

I'll push this change in a little bit (still gotta write commit
message) and indri should go back to green.  Unless one of the
other animals complains, I'll set about back-patching in a
day or two.

                        regards, tom lane


Reply via email to