hassanakbar4 / tractive-test

0 stars 0 forks source link

unexpected element and crash #375

Closed hassanakbar4 closed 2 years ago

hassanakbar4 commented 5 years ago

component_Version_3_cli_txt resolution_fixed type_defect | by miek@miek.nl


on my learninggo.xml xml2rfc-2.10.1 now crashes with:

[1] % make learninggo.txt                                                                                                                 ~/html/learninggo master +
~/g/src/github.com/mmarkdown/mmark/mmark learninggo.md > learninggo.xml
xml2rfc --v3 learninggo.xml
Parsing file learninggo.xml
learninggo.xml(0): Warning: Invalid document before running preptool: Did not expect element section there, line 96
learninggo.xml(5): Warning: The document date (2018-08-25) is more than 3 days away from today's date
Traceback (most recent call last):
  File "/usr/bin/xml2rfc", line 11, in <module>
    load_entry_point('xml2rfc==2.10.1', 'console_scripts', 'xml2rfc')()
  File "/usr/lib/python3/dist-packages/xml2rfc/run.py", line 387, in main
    xmlrfc.tree = prep.prep()
  File "/usr/lib/python3/dist-packages/xml2rfc/writers/preptool.py", line 361, in prep
    func(e, e.getparent())
  File "/usr/lib/python3/dist-packages/xml2rfc/writers/preptool.py", line 1126, in paragraph_add_numbers
    child(e)
  File "/usr/lib/python3/dist-packages/xml2rfc/writers/preptool.py", line 1124, in child
    num = child(c, prefix, num)
  File "/usr/lib/python3/dist-packages/xml2rfc/writers/preptool.py", line 1120, in child
    child(c)
  File "/usr/lib/python3/dist-packages/xml2rfc/writers/preptool.py", line 1108, in child
    prefix = s.get('pn')+'-'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Makefile:15: recipe for target 'learninggo.txt' failed
make: *** [learninggo.txt] Error 1

It's also unclear why this is an invalid doc - in v2 output it would dump a expected author* cite etc thingy which was helpful in debugging. The crash is not help obviously.

Attaching the full xml just in case.


Issue migrated from trac:375 at 2021-10-20 18:29:58 +0500

hassanakbar4 commented 5 years ago

@{"email"=>"miek@miek.nl", "name"=>nil, "username"=>nil} uploaded file learninggo.xml (180.2 KiB)

hassanakbar4 commented 5 years ago

@{"email"=>"henrik@levkowetz.com", "name"=>nil, "username"=>nil} commented


Hi Miek,

Regarding this:

learninggo.xml(0): Warning: Invalid document before running preptool: Did not expect element section there, line 96

I find that on line 96 there's a

within . That's not supposed to fly.

I've also fixed the code where the exception was raised, but the underlying reason for the problem was the invalid xml (

s in don't get pn numbers, so looking up pn numbers on them is going to fail.)

I wish I knew a way to produce as good a list of validation issues with lxml as xmllint can give. Running xmllint on your file shows a list of schema validations that you should fix. I used:

xmllint --relaxng xml2rfc/data/v3.rng --valid --noout issue/375/learninggo.xml
hassanakbar4 commented 5 years ago

@{"email"=>"henrik@levkowetz.com", "name"=>nil, "username"=>nil} changed status from new to closed

hassanakbar4 commented 5 years ago

@{"email"=>"henrik@levkowetz.com", "name"=>nil, "username"=>nil} changed resolution from ` tofixed`

hassanakbar4 commented 5 years ago

@{"email"=>"henrik@levkowetz.com", "name"=>nil, "username"=>nil} commented


Fixed in [2584]:

Fixed several places where unexpected input could cause exceptions. Also turned the invalid input document warning into an error. Fixes issue #375.