#1111803 libxml2-16: xmllint with both --valid and --relaxng yields "Relax-NG validity error : ID ... redefined" errors for IDs defined via an entity reference

Package:
libxml2-16
Source:
libxml2-16
Description:
GNOME XML library
Submitter:
Vincent Lefevre
Date:
2025-08-23 17:03:02 UTC
Severity:
normal
Tags:
#1111803#5
Date:
2025-08-22 07:27:55 UTC
From:
To:
After the upgrade of libxml2 in unstable, xmllint with both --valid
and "--relaxng ..." yields "Relax-NG validity error : ID ... redefined"
errors. With just one of them (i.e. either DTD validation or Relax-NG
validation), the document validates. So this is obviously a bug (and
there were no such errors before the upgrade).

Note: the other options I'm using are
  --nonet --noout --noent --xinclude --loaddtd --dtdattr

I could provide a simple testcase the week-end if need be (the
XML document and associated files are a bit complex).

At the same time, I think I should also be able to test it on Android
to see if this is specific to Debian.

#1111803#10
Date:
2025-08-22 07:36:54 UTC
From:
To:
Obviously, this should have been in the new package.
#1111803#21
Date:
2025-08-22 08:48:12 UTC
From:
To:
Control: retitled -1 libxml2-16: xmllint with both --valid and --relaxng yields "Relax-NG validity error : ID ... redefined" errors for IDs defined via an entity reference

Something important:

There is something like

<!ENTITY elem SYSTEM "elem.xml">

in the DTD, and

&elem;

in the contents. If I replace the "&elem;" by the contents of elem.xml
(without the XML prolog), then the error disappears.

And the errors concern only the IDs defined via this entity reference.

#1111803#28
Date:
2025-08-22 17:34:54 UTC
From:
To:
I can reproduce the bug under Termux/Android, and I've reported
the bug upstream, with a simple testcase.

#1111803#37
Date:
2025-08-23 17:00:17 UTC
From:
To:
Control: tags -1 fixed-upstream patch

The upstream patch against the 2.14 branch[*] (attached) fixes
this bug, for both my simple testcase and my actual files.

[*] https://gitlab.gnome.org/GNOME/libxml2/-/commit/1172b777fae798e2aacac028963bc31353af1ebc