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

text rendering of table leads to crash #740

Open
alicerusso opened this issue Mar 4, 2022 · 2 comments · May be fixed by #801
Open

text rendering of table leads to crash #740

alicerusso opened this issue Mar 4, 2022 · 2 comments · May be fixed by #801
Assignees
Labels
accepted bug Something isn't working

Comments

@alicerusso
Copy link

complex table renders ok in HTML and PDF, but crashes when making text.

When using <table> in XML:

TXT: crashes w/ Traceback as follows.

  File "/usr/bin/xml2rfc", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/xml2rfc/run.py", line 742, in main
    writer.write(filename)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 343, in write
    text = self.process()
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 301, in process
    lines = self.render(self.root, width=72, joiners=joiners)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 367, in render
    res = func(e, width, **kwargs)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 3054, in render_rfc
    lines = self.ljoin(lines, c, width, **kwargs)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 554, in ljoin
    res = mklines(self.render(e, width, **kwargs), e)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 367, in render
    res = func(e, width, **kwargs)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 2232, in render_middle
    lines = self.ljoin(lines, c, width, **kwargs)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 554, in ljoin
    res = mklines(self.render(e, width, **kwargs), e)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 367, in render
    res = func(e, width, **kwargs)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 3325, in render_section
    lines = self.ljoin(lines, c, width, **kwargs)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 554, in ljoin
    res = mklines(self.render(e, width, **kwargs), e)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 367, in render
    res = func(e, width, **kwargs)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 4250, in render_table
    lines = self.build_table(e, width, **kwargs)
  File "/usr/lib/python3.6/site-packages/xml2rfc/writers/text.py", line 4143, in build_table
    k, l = cell.origin
AttributeError: 'Cell' object has no attribute 'origin'
@kesara kesara added the accepted label Mar 8, 2022
@kesara kesara added the bug Something isn't working label Apr 11, 2022
@kesara kesara self-assigned this Jun 21, 2022
@kesara kesara linked a pull request Jun 22, 2022 that will close this issue
@kesara
Copy link
Member

kesara commented Jun 22, 2022

This seems to happen because table cells are unbalanced. Some raws are not fully covering the required number of cells.

With the proposed change, xml2rfc would die with the following error rather than crashing.

draft-zia-route-table2.xml(33): Error: Inconsistent table width: Found different row lengths in this table
Unable to complete processing drafts/draft-zia-route-table2.xml

I will look into improving this error message to give more context.

@cabo
Copy link
Contributor

cabo commented Jun 22, 2022

I cannot find anything in RFC 7991 that would require that table rows are of the same length.
So I don't know why this is an error.
(Throwing a "not implemented" message certainly is better than crashing, but it seems to me there is still work to be done after that PR is merged.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants