tomtom-international / asciidoxy

AsciiDoxy generates API documentation from Doxygen XML output to AsciiDoc.
Apache License 2.0
31 stars 10 forks source link

crash of asciiidoxy #73

Closed prudhomm closed 11 months ago

prudhomm commented 1 year ago

asciidoxy crashes upon execution with the message:

DEBUG: No name found in `typename`,` `,`...`,` `
Loading API reference   :   0%|                                                                                         | 0/1 [00:00<?, ?pkg/s]
Traceback (most recent call last):
  File "/opt/homebrew/bin/asciidoxy", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.10/site-packages/asciidoxy/cli.py", line 70, in main
    pkg_mgr.load_reference(xml_parser, progress)
  File "/opt/homebrew/lib/python3.10/site-packages/asciidoxy/packaging/manager.py", line 150, in load_reference
    parser.parse(xml_file)
  File "/opt/homebrew/lib/python3.10/site-packages/asciidoxy/parser/doxygen/driver.py", line 93, in parse
    tree = ET.parse(file_or_path)
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/xml/etree/ElementTree.py", line 1222, in parse
    tree.parse(source, parser)
  File "/opt/homebrew/Cellar/python@3.10/3.10.8/Frameworks/Python.framework/Versions/3.10/lib/python3.10/xml/etree/ElementTree.py", line 580, in parse
    self._root = parser._parse_whole(source)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 38, column 98

I attached to the issue a data to reproduce. here is the command:

asciidoxy --log DEBUG --spec-file packages.toml reference.adoc

adoc.tag.gz

prudhomm commented 1 year ago

here is a simpler case where I put only one xml file in the xml directory

asciidoxy --log DEBUG --spec-file packages.toml reference.adoc

    ___              _ _ ____             0.8.6
   /   |  __________(_|_) __ \____  _  ____  __
  / /| | / ___/ ___/ / / / / / __ \| |/_/ / / /
 / ___ |(__  ) /__/ / / /_/ / /_/ />  </ /_/ /
/_/  |_/____/\___/_/_/_____/\____/_/|_|\__, /
                                      /____/

Collecting packages     : 0pkg [00:00, ?pkg/s]DEBUG: Using selector: KqueueSelector
Collecting packages     : 100%|████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 881.71pkg/s]
Loading API reference   : 100%|█████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 78.43pkg/s]
Resolving references    : 0ref [00:00, ?ref/s]DEBUG: Resolved refs: 18
DEBUG: Still unresolved: 3: FEELPP_DEPRECATED void, FEELPP_NO_EXPORT void, boost::tuple
Resolving references    : 100%|████████████████████████████████████████████████████████████████████████████| 21/21 [00:00<00:00, 43908.47ref/s]
Preparing work directory: 100%|███████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 3016.40pkg/s]
Processing asciidoc     :   0%|                                                                                        | 0/1 [00:00<?, ?file/s]INFO: Preprocessing reference.adoc
Processing asciidoc     :  50%|████████████████████████████████████████                                        | 1/2 [00:00<00:00, 55.70file/s]
ERROR: Internal error:
Internal consistency error: unknown element id: cpp-classbool. Please file a bug report.
Traceback:
  File /opt/homebrew/lib/python3.10/site-packages/asciidoxy/cli.py, line 95, in main
    documents = process_adoc(in_doc, api_reference, pkg_mgr, config, progress=progress)
  File /opt/homebrew/lib/python3.10/site-packages/asciidoxy/generator/asciidoc.py, line 1001, in process_adoc
    _check_links(context)
  File /opt/homebrew/lib/python3.10/site-packages/asciidoxy/generator/asciidoc.py, line 1013, in _check_links
    raise RuntimeError(f"Internal consistency error: unknown element id: {element_id}."

here is the code to reproduce adoc.tag.gz

here is the command I used:

asciidoxy --log DEBUG --spec-file packages.toml reference.adoc
silvester747 commented 1 year ago

There seem to be two separate issues here. The first one is related to file encoding. The XML decoder is choking on:

Universit� Joseph

The first time I accidentally opened it in Firefox, which reports the same error. It could be an error in Doxygen not properly parsing the Unicode characters and putting invalid characters in the XML file.

Let's see if I can do something about the crash, maybe ignore or try fixing the decoding.

silvester747 commented 11 months ago

Files with invalid encoding will now be skipped and a clear error message is printed.

The other issue is caused by refid=classbool being present in the XML file, but the actual classbool compound is missing. I am not sure why Doxygen is generating this. Changing AsciiDoxy to ignore these unresolved references for now.