Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 558646

Summary: repoman does not check DOCTYPE in metadata.xml when run with python3.4
Product: Portage Development Reporter: Mike Gilbert <floppym>
Component: RepomanAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: jlec, mgorny, pesa
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=328113
https://bugs.gentoo.org/show_bug.cgi?id=552720
Whiteboard:
Package list:
Runtime testing required: ---

Description Mike Gilbert gentoo-dev 2015-08-25 01:07:58 UTC
repoman uses the following code to build a parser for XML:

class _XMLParser(xml.etree.ElementTree.XMLParser):

    def __init__(self, data, **kwargs):
        xml.etree.ElementTree.XMLParser.__init__(self, **kwargs)
        self._portage_data = data
        if hasattr(self, 'parser'):
            self._base_XmlDeclHandler = self.parser.XmlDeclHandler
            self.parser.XmlDeclHandler = self._portage_XmlDeclHandler
            self._base_StartDoctypeDeclHandler = \
                self.parser.StartDoctypeDeclHandler
            self.parser.StartDoctypeDeclHandler = \
                self._portage_StartDoctypeDeclHandler

With Python 3.4 and expat, xml.etree.ElementTree.XMLParser is really just an alias for _elementtree.XMLParser, which is a C extension module that does not contain a "parser" parser attribute.

This causes hasattr(self, 'parser') to return false, and _portage_StartDoctypeDeclHandler is never installed on the object.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-02-04 13:31:11 UTC
FWICS, the code is no longer there and repoman complains about wrong DTD URI w/ py3.5.