Repository navigation
Commit 43fdcd7
authored
Install missing BibTeX style files instead of crashing on Windows (#15377)
When bibtex could not open its style file, the bibliography step
matched `open style file ([^ ]+)` against the whole .blg text. The
character class also matched the newline, so the captured name ran into
the next log line ("agsm.bst\n---line"). That name was then passed to
findAndInstallPackages() as its log file argument: on Windows,
existsSync() throws os error 123 for the invalid name and the render
ends with a raw stack trace; elsewhere the lookup finds no such file and
nothing is installed. The .bst auto-install has not worked since the
latexmk emulation was first written.
That code was ported from TinyTeX's latexmk emulation, which at the time
read the .blg with readLines(), applied the same regex per line, and
passed the extracted names to parse_packages(files = ...), which searches
each name with tlmgr. The port matched against a single string instead
of lines, and had no equivalent of the `files =` entry point, so the
name ended up used as a log path. TinyTeX later moved the pattern into
regex_errors() and switched to parse_packages(text = x)
(rstudio/tinytex@256465d).
Do the same here: add the pattern to packageMatchers next to the other
missing-file patterns ported from regex_errors(), with \S so it stops at
the end of the line, and pass the .blg path to findAndInstallPackages()
so the file is searched with tlmgr like any other missing file. The
style-file check stays in front of the call: without it, any bibtex
failure with nothing to install would now abort the render.
A missing .bst that tlmgr cannot provide now ends with
"no matching packages" and the .blg path, like a missing .sty.
Fixes #153761 parent 4856b1f commit 43fdcd7
4 files changed
Lines changed: 21 additions & 5 deletions
File tree
- news
- src/command/render/latexmk
- tests/unit/latexmk
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
| 491 | + | |
| 492 | + | |
491 | 493 | | |
492 | 494 | | |
493 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
| 434 | + | |
438 | 435 | | |
439 | 436 | | |
440 | 437 | | |
441 | | - | |
| 438 | + | |
442 | 439 | | |
443 | 440 | | |
444 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
86 | 102 | | |
87 | 103 | | |
88 | 104 | | |
| |||
0 commit comments