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

TXT generation fails while HTML and PDF succeed, error message is unhelpful #765

Closed
jgscudder opened this issue Apr 28, 2022 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@jgscudder
Copy link

The attached XML fails to render as txt, with the unhelpful error message "xml2rfc error: text generation error". PDF and HTML succeed. I accept that there might be something wrong with the XML (which is quite old), but the error message doesn't help me figure out what it is.

For that matter, it would be nice to be able to see the more verbose errors-and-warnings form the old xml2rfc site offered.

P.S.: GitHub refused XML attachment, so I added a TXT extension to the attachment to circumvent that
test.xml.txt
.

@jgscudder
Copy link
Author

jgscudder commented Apr 28, 2022

By trial-and-error I worked out that the problem in the XML is the inclusion of

<?rfc toc="no"?>

Obvs this doesn't change the fact that the error message is unhelpful.

@kesara
Copy link
Member

kesara commented Apr 28, 2022

Thanks for the bug report.
In this case, xml2rfc crashed and failed to generate a meaningful error message.
I'm transferring this issue to xml2rfc.

Traceback (most recent call last):
  File "/Users/kesara/lab/xml2rfc/venv/bin/xml2rfc", line 33, in <module>
    sys.exit(load_entry_point('xml2rfc==3.12.4', 'console_scripts', 'xml2rfc')())
  File "/Users/kesara/lab/xml2rfc/venv/lib/python3.9/site-packages/xml2rfc-3.12.4-py3.9.egg/xml2rfc/run.py", line 742, in main
    writer.write(filename)
  File "/Users/kesara/lab/xml2rfc/venv/lib/python3.9/site-packages/xml2rfc-3.12.4-py3.9.egg/xml2rfc/writers/text.py", line 345, in write
    text = self.process()
  File "/Users/kesara/lab/xml2rfc/venv/lib/python3.9/site-packages/xml2rfc-3.12.4-py3.9.egg/xml2rfc/writers/text.py", line 302, in process
    self.add_pageno_placeholders()
  File "/Users/kesara/lab/xml2rfc/venv/lib/python3.9/site-packages/xml2rfc-3.12.4-py3.9.egg/xml2rfc/writers/text.py", line 374, in add_pageno_placeholders
    for e in toc.xpath('.//xref[2]'):
AttributeError: 'NoneType' object has no attribute 'xpath'

@kesara kesara transferred this issue from ietf-tools/ietf-at-ui Apr 28, 2022
@kesara kesara added the bug Something isn't working label Apr 28, 2022
@cabo
Copy link
Contributor

cabo commented Apr 28, 2022

Pagination code assumes there is a ToC (to which to insert page numbers).
You can still get .txt without ToC using --no-pagination

cabo added a commit to cabo/xml2rfc that referenced this issue Apr 28, 2022
@jgscudder
Copy link
Author

Thanks for the bug report. In this case, xml2rfc crashed and failed to generate a meaningful error message. I'm transferring this issue to xml2rfc.

Possibly it would be slightly more helpful to the user to expose the crash/stack trace information? Or at least instead of the very general "text generation error" (which could mean almost anything) say something more specific like "xml2rfc crashed"?

@kesara
Copy link
Member

kesara commented May 1, 2022

Thanks for the bug report. In this case, xml2rfc crashed and failed to generate a meaningful error message. I'm transferring this issue to xml2rfc.

Possibly it would be slightly more helpful to the user to expose the crash/stack trace information? Or at least instead of the very general "text generation error" (which could mean almost anything) say something more specific like "xml2rfc crashed"?

Showing crash/stack trace in an online service can lead to security vulnerabilities [1].
Maybe author tools UI can be improved to provide a link to GitHub issues to open an issue on GitHub when such unexpected errors occurred?

1: OWASP - Improper Error Handling

@cabo
Copy link
Contributor

cabo commented May 1, 2022 via email

@kesara
Copy link
Member

kesara commented May 1, 2022

I've created ietf-tools/ietf-at-ui#87 for author tools changes on error handling.

kesara pushed a commit to kesara/xml2rfc that referenced this issue May 2, 2022
kesara pushed a commit to cabo/xml2rfc that referenced this issue May 6, 2022
@kesara kesara closed this as completed May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants