Skip to content
New issue

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

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

Already on GitHub? # to your account

xml2rfc crashes on unprepped draft with preptime #1179

Open
1 task done
kesara opened this issue Oct 17, 2024 · 0 comments
Open
1 task done

xml2rfc crashes on unprepped draft with preptime #1179

kesara opened this issue Oct 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kesara
Copy link
Member

kesara commented Oct 17, 2024

Describe the issue

xml2rfc crashes when a unprepped draft is published with prepTime attribute in rfc element.
Example:

<?xml version="1.0" encoding="utf-8"?>
<rfc ipr="trust200902" docName="dradraft-doe-preptime-test-00" prepTime="2024-10-17T08:53:24" category="exp" version="3">
  <front>
    <title abbrev="preptime-test">Preptime Test</title>
    <author fullname="Jane Doe">
      <address>
        <postal>
          <country>NZ</country>
        </postal>
        <email>jane@example.org</email>
      </address>
    </author>

    <abstract>
    <t>Omnis omnis iusto impedit ipsam. Ex eligendi earum expedita molestiae tenetur. Et nobis nihil perspiciatis temporibus quaerat facilis sit et.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction" title="Introduction">
      <t>Ratione assumenda magni nostrum accusamus nemo eum. Assumenda sit eum culpa odio doloribus mollitia ipsum. Repellendus dolore qui aliquid cupiditate totam. Blanditiis dolorum animi quo optio nemo.</t>
    </section>
  </middle>

  <back>
  </back>
</rfc>

Error:

Traceback (most recent call last):
  File "/usr/local/bin/xml2rfc", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/run.py", line 723, in main
    writer.write(filename)
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 340, in write
    text = self.process()
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 304, in process
    lines = self.render(self.root, width=MAX_WIDTH, joiners=joiners)
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 364, in render
    res = func(e, width, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 3082, in render_rfc
    lines = self.ljoin(lines, c, width, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 553, in ljoin
    res = mklines(self.render(e, width, **kwargs), e)
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 364, in render
    res = func(e, width, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 1788, in render_front
    text = '\n\n\n\n' + self.render_first_page_top(e, width, **kwargs) + '\n'
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 2010, in render_first_page_top
    right = get_right(e)
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 2006, in get_right
    right.append(self.render_date(front.find('./date'), width, **kwargs))
  File "/usr/local/lib/python3.10/dist-packages/xml2rfc/writers/text.py", line 1368, in render_date
    have_date = e.get('day') or e.get('month') or e.get('year')
AttributeError: 'NoneType' object has no attribute 'get'

This error is due to the lack of date element.
But there can be more errors down the line.

Code of Conduct

@kesara kesara added the bug Something isn't working label Oct 17, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant