Univention Bugzilla – Full Text Bug Listing |
Summary: | "xm list" aborts with xml.parsers.expat.ExpatError | ||
---|---|---|---|
Product: | UCS | Reporter: | Philipp Hahn <hahn> |
Component: | Virtualization - Xen | Assignee: | Philipp Hahn <hahn> |
Status: | CLOSED FIXED | QA Contact: | Erik Damrose <damrose> |
Severity: | normal | ||
Priority: | P5 | CC: | gohmann, jmm |
Version: | UCS 3.2 | Flags: | hahn:
Patch_Available+
|
Target Milestone: | UCS 3.2-4-errata | ||
Hardware: | All | ||
OS: | Linux | ||
What kind of report is it?: | --- | What type of bug is this?: | --- |
Who will be affected by this bug?: | --- | How will those affected feel about the bug?: | --- |
User Pain: | Enterprise Customer affected?: | ||
School Customer affected?: | ISV affected?: | ||
Waiting Support: | Flags outvoted (downgraded) after PO Review: | ||
Ticket number: | Bug group (optional): | ||
Max CVSS v3 score: | |||
Attachments: |
HACK system XML parser to ignore ASCII control characters
xend: Fix hex decoding in sxp.Parser |
Description
Philipp Hahn
2014-10-08 16:33:03 CEST
This is a XenD bug, which is hidden by UVMMd: albeit the broken description is fetched through libvirt, it gets overwritten by the still correct variant from LDAP: # virsh -c xen://lynx4.phahn.dev/ desc 783df368-2a6b-ae6d-88b5-ec8ffda059e4 Fr\\xc3\\xbcher war alles Schl\\xc3\\xa4cha!\\xe2\\x82\\xac # udm uvmm/info list --filter uuid=783df368-2a6b-ae6d-88b5-ec8ffda059e4 | grep desc description: Früher war alles Schlächa!€ # grep Fr /var/lib/xend/domains/783df368-2a6b-ae6d-88b5-ec8ffda059e4/config.sxp 'Fr\\xc3\\xbcher war aller Schl\\xc3\\xa4cha!\\xe2\\x82\\xac' 'Fr\\xc3\\xbcher war aller Schl\\xc3\\xa4cha!\\xe2\\x82\\xac' For each round of "virsh edit $DOM" the escaping get duplicated. src/xenconfig/xen_sxpr.c: XenD -> libvirt 1128 if (sexpr_node_copy(root, "domain/description", &def->description) < 0) 1129 goto error; libvirt -> XenD 2222 if (def->description) 2223 virBufferEscapeSexpr(&buf, "(description '%s')", def->description); Created attachment 6173 [details] xend: Fix hex decoding in sxp.Parser "xm list" sometimes failes with the following traceback: > Traceback (most recent call last): > File "/root/36098_xend-expat.py", line 84, in <module> > main_xmlrpc() > File "/root/36098_xend-expat.py", line 50, in main_xmlrpc > result = xend.xend.domain(UUID) > File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__ > return self.__send(self.__name, args) > File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request > verbose=self.__verbose > File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request > return self._parse_response(h.getfile(), sock) > File "/usr/lib/python2.6/xmlrpclib.py", line 1387, in _parse_response > p.feed(response) > File "/usr/lib/python2.6/xmlrpclib.py", line 601, in feed > self._parser.Parse(data, 0) > xml.parsers.expat.ExpatError: not well-formed (invalid token): line 45, column 18 This happens when the descriptive text for a VM contains non-ASCII-characters, which xen.xend.sxp.show() converts to Python hex-escapes: > print repr(unichr(8364).encode('UTF-8')) > '\xe2\x82\xac' On read-back those are processed by xen.xend.sxp.Parser.state_hex(), which is broken: 'a'..'f' respective 'A'..'F' are converted to 0..5 instead of 10..15. Thus the above sequence gets read back as: 'B\x82\x02'. When converted to XML this produces invalid XML, which breaks expat. Use Pythont int(..., 16) instead. r56410 | Bug #36098 xen: Fix hex decoding in sxp.Parser Package: xen-4.1 Version: 4.1.3-17.43.201412031229 Branch: ucs_3.2-0 Scope: errata3.2-4 r56413 | Bug #36098 xen: Fix hex decoding in sxp.Parser YAML 2014-12-03-xen-4.1.yaml Whoops, forgot to actually set this bug to verified.. OK: code change OK: having umlauts in the VM description does no longer crash xm list OK: YAML Verified |