Skip to content

Commit 69936dd

Browse files
authored
Fix double-escaped "(file ...): cannot open" LaTeX package matcher (#15385)
The pattern was copied from tinytex's R source, where the string '.* \\(file ([^)]+)\\): cannot open .*' denotes the regex \(. Pasted into a JS regex literal, \\( instead requires a literal backslash before "(file", so the matcher never matched a real log line. The existing "!pdfTeX error: ... (file 8r.enc): cannot open ..." test kept passing because the font matcher also catches lines with a "! ... error:" prefix. The new test covers the same message without that prefix.
1 parent 6cec6f2 commit 69936dd

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎src/command/render/latexmk/parse-error.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ const packageMatchers = [
487487
return `${match}.ldf`;
488488
},
489489
},
490-
{ regex: /.* \\(file ([^)]+)\\): cannot open .*/g },
490+
{ regex: /.* \(file ([^)]+)\): cannot open .*/g },
491491
// bibtex .blg log; \S keeps the match off the next log line
492492
{ regex: /.* open style file (\S+).*/g },
493493
{ regex: /.*file [`']([^']+)' .*is missing.*/g },

‎tests/unit/latexmk/parse-error.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ unitTest("Detect missing files with `findMissingFontsAndPackages`", async () =>
5353
(babel) Suggested actions:
5454
(babel) * Make sure you haven't misspelled it`, "ngerman.ldf");
5555
assertFound("!pdfTeX error: pdflatex (file 8r.enc): cannot open encoding file for reading", "8r.enc");
56+
assertFound("pdflatex (file 8r.enc): cannot open encoding file for reading", "8r.enc");
5657
assertFound("! CTeX fontset `fandol' is unavailable in current mode", "fandol");
5758
assertFound("! CTeX fontset 'fandol' is unavailable in current mode", "fandol");
5859
assertFound('Package widetext error: Install the flushend package which is a part of sttools', "flushend.sty");

0 commit comments

Comments
 (0)