Subject: [xml2rfc] Missing <TD> - xml2rfc crashes

From: Roger Price <[email-masked]>
Date: Fri, 2 Jul 2021 15:54:44 +0200 (CEST)

xml2rfc version 3.5.0.  When a <td> is missing in a table as in:

<table>
<thead>
<tr><th>Command     <th>Response             <th>Note
<tbody>
<tr><td>FSD         <td>OK FSD-SET
</table>

I get the error message:

Traceback (most recent call last):
   File "/usr/bin/xml2rfc", line 11, in <module>
     sys.exit(main())
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/run.py",
     line 739, in main
     writer.write(filename)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 345, in write
     text = self.process()
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 301, in process
     lines = self.render(self.root, width=72, joiners=joiners)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 369, in render
     res = func(e, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 3059, in render_rfc
     lines = self.ljoin(lines, c, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 561, in ljoin
     res = mklines(self.render(e, width, **kwargs), e)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 369, in render
     res = func(e, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 2237, in render_middle
     lines = self.ljoin(lines, c, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 561, in ljoin
     res = mklines(self.render(e, width, **kwargs), e)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 369, in render
     res = func(e, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 3329, in render_section
     lines = self.ljoin(lines, c, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 561, in ljoin
     res = mklines(self.render(e, width, **kwargs), e)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 369, in render
     res = func(e, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 3329, in render_section
     lines = self.ljoin(lines, c, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 561, in ljoin
     res = mklines(self.render(e, width, **kwargs), e)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 369, in render
     res = func(e, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 3329, in render_section
     lines = self.ljoin(lines, c, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 561, in ljoin
     res = mklines(self.render(e, width, **kwargs), e)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 369, in render
     res = func(e, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 4199, in render_table
     lines = self.build_table(e, width, **kwargs)
   File "/mnt/home/rprice/.local/lib/python3.5/site-packages/xml2rfc/writers/text.py",
     line 3982, in build_table
     del k, l
UnboundLocalError: local variable 'k' referenced before assignment

Roger

---

From: Carsten Bormann <[email-masked]>
Date: Fri, 2 Jul 2021 16:05:16 +0200

> On 2021-07-02, at 15:54, Roger Price <[email-masked]> wrote:
> 
> xml2rfc version 3.5.0.  

https://trac.ietf.org/trac/xml2rfc/ticket/512

Fixed in 3.6.0 (which came out 2021-03-17).

<https://mailarchive.ietf.org/arch/msg/rfc-markdown/t8i6q7-n5990mXbgkppQy-MT_v0> says:

> xml2rfc (3.6.0) ietf; urgency=medium
> 
>  * Merged in [3899] from [email-masked]:
>    Prevent crash when column count varies between table rows. Fixes #512.
> 

It does pay to upgrade occasionally!

Grüße, Carsten

---

From: Roger Price <[email-masked]>
Date: Fri, 2 Jul 2021 16:51:48 +0200 (CEST)

> It does pay to upgrade occasionally!

You are right, and my apologies for polluting the list with SGML source code. 
Roger