Serialization of notation declarations is non-deterministic
Summary
I compiled libxml2 with gcc11
. For the provided input, the xmllint --revover
would produce different results per run. This was troublesome for me when I was expecting the same results across runs.
Version
git HEAD 57b3abd5
Reproduce
- Compile with
gcc11
(I tried withclang13
as well, which does not have this problem). - Run
./xmllint --recover issue-333 | md5sum -
multiple times and you'll observer the outputs sometimes change. - issue-333
diff -y
comparison results are as follows. You can find that the order of the third and forth lines is different.
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE doc [ <!DOCTYPE doc [
<!NOTATION gIf SYSTEM "viewgif.exe" > <
<!NOTATION kIf SYSTEM "vieo" > <!NOTATION kIf SYSTEM "vieo" >
> <!NOTATION gIf SYSTEM "viewgif.exe" >
<!ATTLIST doc attrExtEnt ENTITY #IMPLIED> <!ATTLIST doc attrExtEnt ENTITY #IMPLIED>
<!ENTITY ent1 "Hello"> <!ENTITY ent1 "Hello">
<!ENTITY ent2 SYSTEM "world.txt"> <!ENTITY ent2 SYSTEM "world.txt">
<!ENTITY entExt SYSTEM "earth.gif" NDATA gif> <!ENTITY entExt SYSTEM "earth.gif" NDATA gif>
]> ]>
<doc attrExtEnt="entExt"> <doc attrExtEnt="entExt">
&ent1;, &ent2;! &ent1;, &ent2;!
</doc> </doc>
Edited by Nick Wellnhofer