libxml2 2.9.12+dfsg-3 causes regression

Bug #1943277 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libxml2 (Ubuntu)
Fix Released
High
Mattia Rizzolo

Bug Description

root@i1:~# cat example.xml
<domain type="qemu">
  <name>fake-name</name>
  <os>
    <type/>
  </os>
  <devices>
    <interface type="bridge">
      <mac address="22:52:25:62:e2:aa"/>
      <model type="virtio"/>
      <source bridge="br0"/>
      <mtu size="9000"/>
      <target dev="nicdc065497-3c"/>
      <bandwidth>
        <inbound average="100" peak="200" burst="300"/>
        <outbound average="10" peak="20" burst="30"/>
      </bandwidth>
    </interface>
  </devices>
</domain>

root@i1:~# cat xml.py
from lxml import etree

def parseXML(xmlFile):
    # Parse the xml
    with open(xmlFile) as fobj:
        xml = fobj.read()

    doc = etree.fromstring(xml)
    ret = doc.findall('./devices/interface')
    node_xml = etree.tostring(ret[0]).decode()
    print("node_xml={}".format(node_xml))

if __name__ == "__main__":
    parseXML("example.xml")

== Expected result ==

root@i1:~# python3 xml.py
node_xml=<interface type="bridge">
      <mac address="22:52:25:62:e2:aa"/>
      <model type="virtio"/>
      <source bridge="br0"/>
      <mtu size="9000"/>
      <target dev="nicdc065497-3c"/>
      <bandwidth>
        <inbound average="100" peak="200" burst="300"/>
        <outbound average="10" peak="20" burst="30"/>
      </bandwidth>
    </interface>

== Actual Result ==

root@i1:~# python3 xml.py
node_xml=<interface type="bridge">
      <mac address="22:52:25:62:e2:aa"/>
      <model type="virtio"/>
      <source bridge="br0"/>
      <mtu size="9000"/>
      <target dev="nicdc065497-3c"/>
      <bandwidth>
        <inbound average="100" peak="200" burst="300"/>
        <outbound average="10" peak="20" burst="30"/>
      </bandwidth>
    </interface>
  </devices>
</domain>

This is broken in 2.9.12+dfsg-3 on impish.
It is not broken in 2.9.10+dfsg-6.3ubuntu0.1 on hirsute.

There are some fixes in master since the 2.9.12 release was cut.
https://gitlab.gnome.org/GNOME/libxml2/-/commits/master

I'm planning to pick all 3 of the following commits from upstream master since they are all intertwined. With this patches the regression is fixed.

85b1792e37b131e7a51af98a37f92472e8de5f3f:
Work around lxml API abuse. Make xmlNodeDumpOutput and htmlNodeDumpFormatOutput work with corrupted parent pointers.

13ad8736d294536da4cbcd70a96b0a2fbf47070c:
Add patch from upstream to fix regression in xmlNodeDumpOutputInternal. Commit 85b1792e could cause additional whitespace if xmlNodeDump was called with a non-zero starting level.

92d9ab4c28842a09ca2b76d3ff2f933e01b6cd6f:
Add patch from upstream to fix whitespace when serializing empty HTML documents.

summary: - libxml2 causes regression in python3-lxml2
+ libxml2 2.9.12+dfsg-3 causes regression
description: updated
description: updated
Changed in libxml2 (Ubuntu):
status: New → Triaged
importance: Undecided → High
Mattia Rizzolo (mapreri)
Changed in libxml2 (Ubuntu):
assignee: nobody → Mattia Rizzolo (mapreri)
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libxml2 - 2.9.12+dfsg-4

---------------
libxml2 (2.9.12+dfsg-4) unstable; urgency=medium

  * Team upload.
  * Add a few patches from upstream:
    + Work around lxml API abuse.
    + Fix regression in xmlNodeDumpOutputInternal. LP: #1943277
    + Fix whitespace when serializing empty HTML documents.
    + Forbid epsilon-reduction of final states.
    + Fix buffering in xmlOutputBufferWrite.

 -- Mattia Rizzolo <email address hidden> Fri, 10 Sep 2021 22:13:09 +0200

Changed in libxml2 (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.