Subject: [xml2rfc] #375 (Version_3_cli_txt): unexpected element and crash

From: "xml2rfc issue tracker" <[email-masked]>
Date: Tue, 18 Sep 2018 19:30:29 -0000

#375: unexpected element and crash

 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.

-- 
-------------------------------+-------------------
 Reporter:  [email-masked]       |      Owner:
     Type:  defect             |     Status:  new
 Priority:  medium             |  Milestone:
Component:  Version_3_cli_txt  |    Version:  2.4.x
 Keywords:                     |
-------------------------------+-------------------

Ticket URL: <https://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/375>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>

---

From: "xml2rfc issue tracker" <[email-masked]>
Date: Tue, 18 Sep 2018 22:43:41 -0000

Comment (by [email-masked]):

 Hi Miek,

 Regarding this:
 {{{

 I find that on line 96 there's a <section/> within <front/>.  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 (<section>s in
 <front> 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
 }}}

-- 
--------------------------------+-------------------
Resolution:                     |   Keywords:
--------------------------------+-------------------

Ticket URL: <https://trac.tools.ietf.org/tools/xml2rfc/trac/ticket/375#comment:1>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>

---

From: "xml2rfc issue tracker" <[email-masked]>
Date: Tue, 18 Sep 2018 22:45:58 -0000

Changes (by [email-masked]):

 * status:  new => closed
 * resolution:   => fixed

Comment:

 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.

-- 
--------------------------------+--------------------
  Reporter:  [email-masked]       |      Owner:
      Type:  defect             |     Status:  closed
  Priority:  medium             |  Milestone:
 Component:  Version_3_cli_txt  |    Version:  2.4.x
Resolution:  fixed              |   Keywords:
--------------------------------+--------------------

Ticket URL: </ticket/375#comment:2>
xml2rfc <http://tools.ietf.org/tools/xml2rfc/>