component_Version 2 cliresolution_overtaken by eventstype_defect | by elwynd@dial.pipex.com
The intention (c.f., draft-reschke-xml2rfc-09) is apparently that the anchor attribute of elements is now mandatory. As of v2.4.6 (svn 1450),
the DTD used by xml2rfc (trunk/cli/xml2rfc/templates/rfc2929.dtd) has:
<!ELEMENT reference (front,seriesInfo,format,annotation*)>
<!ATTLIST reference
anchor ID #IMPLIED
target %URI; #IMPLIED>
making the anchor optional.
Accordingly parsing a xml2rfc source with a reference that has no anchor attribute does not trigger an XML parsing error, but it crashes later with the following traceback (from the online version):
Traceback (most recent call last):
File "/usr/local/bin/xml2rfc", line 5, in
pkg_resources.run_script('xml2rfc==2.4.9dev0', 'xml2rfc')
File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 534, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 1434, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/xml2rfc-2.4.9dev0-py2.7.egg/EGG-INFO/scripts/xml2rfc", line 225, in
main()
File "/usr/local/lib/python2.7/dist-packages/xml2rfc-2.4.9dev0-py2.7.egg/EGG-INFO/scripts/xml2rfc", line 210, in main
pagedwriter.write(filename)
File "/usr/local/lib/python2.7/dist-packages/xml2rfc-2.4.9dev0-py2.7.egg/xml2rfc/writers/base.py", line 1180, in write
self._build_index()
File "/usr/local/lib/python2.7/dist-packages/xml2rfc-2.4.9dev0-py2.7.egg/xml2rfc/writers/base.py", line 1022, in _build_index
self._indexRef(ref_counter, title=title, anchor=ref.attrib["anchor"])
File "lxml.etree.pyx", line 2295, in lxml.etree._Attrib.getitem (src/lxml/lxml.etree.c:59806)
KeyError: 'anchor'
The error occurs whether the PI is symrefs="no" or symrefs="yes".
A file that triggers the error is attached.
Presumably the fix is to change the DTD from:
anchor ID #IMPLIED
to:
anchor ID #REQUIRED
Note: This part of the DTD has been copied over from v1.36. The online v1 tool also crashes when symrefs="no" but produces a sensible error message when symrefs="yes".
Issue migrated from trac:268 at 2021-10-20 18:16:43 +0500
component_Version 2 cli
resolution_overtaken by events
type_defect
| by elwynd@dial.pipex.comThe intention (c.f., draft-reschke-xml2rfc-09) is apparently that the anchor attribute of elements is now mandatory. As of v2.4.6 (svn 1450),
the DTD used by xml2rfc (trunk/cli/xml2rfc/templates/rfc2929.dtd) has:
<!ELEMENT reference (front,seriesInfo,format,annotation*)>
<!ATTLIST reference
anchor ID #IMPLIED
target %URI; #IMPLIED>
making the anchor optional.
Accordingly parsing a xml2rfc source with a reference that has no anchor attribute does not trigger an XML parsing error, but it crashes later with the following traceback (from the online version): Traceback (most recent call last): File "/usr/local/bin/xml2rfc", line 5, in
pkg_resources.run_script('xml2rfc==2.4.9dev0', 'xml2rfc')
File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 534, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources.py", line 1434, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/xml2rfc-2.4.9dev0-py2.7.egg/EGG-INFO/scripts/xml2rfc", line 225, in
main()
File "/usr/local/lib/python2.7/dist-packages/xml2rfc-2.4.9dev0-py2.7.egg/EGG-INFO/scripts/xml2rfc", line 210, in main
pagedwriter.write(filename)
File "/usr/local/lib/python2.7/dist-packages/xml2rfc-2.4.9dev0-py2.7.egg/xml2rfc/writers/base.py", line 1180, in write
self._build_index()
File "/usr/local/lib/python2.7/dist-packages/xml2rfc-2.4.9dev0-py2.7.egg/xml2rfc/writers/base.py", line 1022, in _build_index
self._indexRef(ref_counter, title=title, anchor=ref.attrib["anchor"])
File "lxml.etree.pyx", line 2295, in lxml.etree._Attrib.getitem (src/lxml/lxml.etree.c:59806)
KeyError: 'anchor'
The error occurs whether the PI is symrefs="no" or symrefs="yes".
A file that triggers the error is attached.
Presumably the fix is to change the DTD from: anchor ID #IMPLIED to: anchor ID #REQUIRED
Note: This part of the DTD has been copied over from v1.36. The online v1 tool also crashes when symrefs="no" but produces a sensible error message when symrefs="yes".
Issue migrated from trac:268 at 2021-10-20 18:16:43 +0500