Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected element and crash #375

Closed
ietf-svn-bot opened this issue Sep 18, 2018 · 5 comments
Closed

unexpected element and crash #375

ietf-svn-bot opened this issue Sep 18, 2018 · 5 comments
Labels
medium text Issues in text output

Comments

@ietf-svn-bot
Copy link

resolution_fixed type_defect | by miek@miek.nl


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

5f1f8b9ced72dea365b98717219bbeadc86cce74 % 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 2022-02-05 12:46:24 +0000

@ietf-svn-bot
Copy link
Author

@miek@miek.nl uploaded file learninggo.xml (180.2 KiB)

@ietf-svn-bot
Copy link
Author

@henrik@levkowetz.com 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

@ietf-svn-bot
Copy link
Author

@henrik@levkowetz.com changed status from new to closed

@ietf-svn-bot
Copy link
Author

@henrik@levkowetz.com changed resolution from `` to fixed

@ietf-svn-bot
Copy link
Author

@henrik@levkowetz.com commented


Fixed in 2ce8177:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium text Issues in text output
Projects
None yet
Development

No branches or pull requests

1 participant