]> git.lyx.org Git - lyx.git/commitdiff
Improve log scanner to correctly report error
authorScott Kostyshak <skostysh@lyx.org>
Sat, 21 Feb 2015 05:00:51 +0000 (00:00 -0500)
committerScott Kostyshak <skostysh@lyx.org>
Fri, 20 Mar 2015 06:19:44 +0000 (02:19 -0400)
When scanning the LaTeX log, previously we only looked ahead 10 lines
after a "!" line and if we did not find a line number we did not count
an error. This lead to the problem that templates/ACM-sigplan.lyx was
showing a successful export and the PDF was shown (it is still
created despite the error). Now that the exit code of the latex
command is checked (as of the previous commit), an error is correctly
given, but by parsing the log better with this commit, a more
informative error is given.

Increasing the look-ahead to 15 lines leads to correct parsing of
the ACM-sigplan log. The excerpt in the log file where there are more
than 10 lines in-between the "!" line and the line number is below:

! Undefined control sequence.
\@toappear ...ent http://dx.doi.org/10.1145/\@doi

<argument> ...n is removed.]\par \else \@toappear
                                                  \fi \if \@reprint
\noinden...

\@begin@tempboxa ...mpboxa #1{\color@begingroup #2
                                                  \color@endgroup }\def
\wid...

\@iiiparbox ...tempdima \@parboxrestore #5\@@par }
                                                  \ifx \relax #2\else
\setle...

\@copyrightspace ...planconf@finalpage}.\par \fi }
                                                  }\end@float
\maketitle ... \@copyrightwanted \@copyrightspace
                                                  \fi
l.34 \maketitle

Another example is posted here:
http://tex.stackexchange.com/questions/231655/lyx-cannot-output-to-pdflatex-for-a-specific-file

src/LaTeX.cpp

index 588ca522e4432d7129e90a7e776f334bb310cf21..e4f8b4b4902f33e84d73661aca2aed22517d49cf 100644 (file)
@@ -825,7 +825,10 @@ int LaTeX::scanLogFile(TeXErrors & terr)
                                if (!getline(ifs, tmp))
                                        break;
                                tmp = rtrim(tmp, "\r");
-                               if (++count > 10)
+                               // 15 is somewhat arbitrarily chosen, based on practice.
+                               // We used 10 for 14 years and increased it to 15 when we
+                               // saw one case.
+                               if (++count > 15)
                                        break;
                        } while (!prefixIs(tmp, "l."));
                        if (prefixIs(tmp, "l.")) {