Files
business-suite/BUGS.md
T

38 lines
3.0 KiB
Markdown
Raw Normal View History

# Bugs
Defects of the suite, each with its cause, its correction and the test that measures it.
## Search through every folder below the document
- **Found:** 2026-11-14, converting a document at the root of a checkout of 68377 folders: the conversion took 56 minutes 24 seconds, of which the probe 12 minutes 39 seconds and the first of the two LaTeX runs of the document 21 minutes 41 seconds.
- **Cause:** the converter named the suite, the folder of the document and the build folder in `TEXINPUTS` with a trailing `//`. kpathsea expands such an entry into every folder below it and tries each file name in all of them before the TeX tree, which comes last: one lookup of `fontspec.sty` took 257 seconds instead of 0.15. A file named like a package of TeX Live anywhere below the document replaced that package, and a package in a test build of the suite could serve as the identity of a company.
- **Fix:** the converter names the package folder of the suite, the folder of the document and the build folder without `//`. The same document converts in 11.5 seconds.
- **Test:** `tests/md2pdf.py` › `subfolders` (F11.16).
## An HTML table opens the address of an iframe
- **Found:** 2026-11-14, in the security review of the HTML table filter: a cell with `<iframe src="http://127.0.0.1:…/page.html">` made the build send a GET to that address and put the page into the PDF.
- **Cause:** `bin/html.lua` read the raw table with the HTML reader of pandoc in the global environment, which fetches what an iframe names.
- **Fix:** the table is read in an empty sandbox.
- **Test:** `tests/md2pdf.py` › `html_sandbox` (F11.14).
## A form label is read as LaTeX
- **Found:** 2026-11-14, in the security review of the form filter: a label `Notes}\input{<file>}\iffalse` put the file into the PDF, and a `%`, `&` or `#` in a label stopped the build.
- **Cause:** `bin/forms.lua` wrote the label into `\businessremark`, `\businessline` and `\businesslabelwidth` as it stood.
- **Fix:** every label is written through the LaTeX writer of pandoc, which escapes it.
- **Test:** `tests/forms.py` › `labels` (F13.4).
## The form pattern takes quadratic time on a long line
- **Found:** 2026-11-14, in the security review of the converter: 0.29 seconds for a line of 20000 characters, 1.01 for 40000, 3.6 for 100000.
- **Cause:** `^.*\S.*:` in the pattern `FORM` of `bin/md2pdf.py` tried every split of a line between its two `.*`.
- **Fix:** the label part scans a line once and matches the same lines.
- **Test:** `tests/md2pdf.py` › `form_pattern` (F13.5).
## A kept build folder lays old drawing links over a new drawing
- **Found:** 2026-11-14, in the security review of the drawing filter.
- **Cause:** the drawings are numbered from one in every run, and `bin/svg.lua` wrote no link file for a drawing without links, so with `--keep-tex` the file of the earlier drawing of that number stayed and the template read it.
- **Fix:** the link file of the drawing is removed before the links are written.
- **Test:** `tests/md2pdf.py` › `stale_links` (F11.17).