Commit Graph

71 Commits

Author SHA1 Message Date
Scott Kostyshak
1dbf0e5aab Check exit code of LaTeX process in LaTeX::run
Systemcall::startscript returns the exit code of the LaTeX command
that is run, but the return value was not being checked by
LaTeX::run.  Instead, we relied on parsing log files. However, this
parsing is not perfect.

The return value is now checked and if the exit code of the command
is non-zero, an enum value is added to the return and the user is
notified of the error.

At a higher level, if the LaTeX command returns a non-zero exit code,
in the GUI a message such as
"Error while exporting format: PDF (LuaTeX)" will be given instead of
"Successful preview of format: PDF (LuaTeX)".

When run on the commandline, lyx -e lualatex example.lyx
will give "Error: LaTeX failed" and a non-zero exit code
where before it gave a zero exit code.

A real example of the bug this commit fixes is LyX's (as of this commit)
ACM-sigplan.lyx template.
Before this commit:
  $ lyx -e pdf2 ACM-sigplan.lyx
  [...snip...]
  support/Systemcall.cpp (288): Systemcall: 'pdflatex  "ACM-sigplan.tex"'
  finished with exit code 1
  $ echo $?
  0
Starting with this commit:
  $ mylyx master -e pdf2 ACM-sigplan.lyx
  support/Systemcall.cpp (288): Systemcall: 'pdflatex  "ACM-sigplan.tex"'
  finished with exit code 1
  Error: LaTeX failed
  ----------------------------------------
  LaTeX did not run successfully. The command that was run exited with
  error.
  $ echo $?
  1
2015-03-20 02:19:44 -04:00
Scott Kostyshak
4f0593f91b Remove an outdated comment
LaTeX::deleteFilesOnError is no longer a dummy function.

This comment was interoduced with the first version of this
function, at e6d063c4.
2015-03-20 02:19:44 -04:00
Scott Kostyshak
2bfbf75eed Remove output file in temporary folder on error
This commit solves two issues:

(1) A PDF from a previous run could have been the result of a command
that exited with error (e.g. sometimes pdflatex still produces a PDF if
it exits with error). If the "View" button were clicked a second time
without changing the .lyx file, then the checksum of the .tex file would
not have changed so LyX would show the PDF (which was created from the
first run that exited with error), and this time LyX would not report
the error (because the parsing of the logs only happens when the .tex
file is compiled).

(2) A myfile.tex that results in no output does not yield a myfile.pdf.
Thus, Any myfile.pdf in the temporary directory will not be overwritten.
Before this commit, the following scenario was possible: LyX runs
pdflatex which processes myfile.tex and no error is given so LyX opens
myfile.pdf. However, it could have been the scenario that pdflatex did
not exit with error and did not create myfile.pdf, in which case
whichever myfile.pdf is being shown is not correct. To see this bug in
action, start a new document, type "abc", view the PDF, delete "abc",
view the PDF (this correctly gives an error that empty output was
created), view the PDF again (this does not give an error because the
checksum has not changed). The PDF shown will contain "abc".

Note that the above also applies to DVI files and that the fix is
general.
2015-03-20 02:19:26 -04:00
Georg Baum
e5845fea49 Fix memory error detected by valgrind
The assignment name = sub.str(1) reads from the first argument given to
regex_match(), but previously this was a temporary object which was already
out of scope. This did probably not matter much in practice, but invoked
undefined behaviour, and as we all know this is allowed ton format your hard
disk or kill to your cat, so better fix this.
2014-11-17 22:08:21 +01:00
Jean-Marc
93a43742a5 Fix a bunch of small performance issues spotted by cppcheck
Most of these are about passing const strings parameters as references.
2014-07-05 19:13:10 +02:00
Richard Heck
fdbe775b9f This is the result of an audit of all static variables, looking
for possible thread conflicts, of the sort Georg resolved at
6a30211f. I have made static variables const where possible,
and marked cases that looked potentially problematic with the
comment:
	// FIXME THREAD
Many of these definitely are vulnerable to concurrent access, such
as the static variables declared at the start of output_latex.cpp.
Suppose, e.g., we were outputting latex and also displaying the
source of a different document.

I'd appreciate it if others could grep for "FIXME THREAD" and see
if some of these are harmless, or what.
2014-04-21 11:51:57 -04:00
Juergen Spitzmueller
0766f94ee0 Recognize changed babel error message (rewording) 2013-12-14 13:19:40 +01:00
Juergen Spitzmueller
027b5dc4af Rerun makeindex if all nomencl entries have been removed (#8905) 2013-12-02 14:36:18 +01:00
Juergen Spitzmueller
7e188c515e Catch and report BibTeX/biber errors (#2757) 2013-05-27 17:27:05 +02:00
Julien Rioux
2e72a0af48 Add known citation packages to LaTeXFeatures:
- achicago
  - apacite
  - apalike
  - astron
  - authordate
  - chicago
  - harvard
  - mslapa
  - named

This allows these citation packages can be Required by the document layout.
LyX handles the package ordering, loading any of these packages before natbib
when both are required by the document layout. For example, apacite can be
used with or without natbib.

The package achicago isn't compatible with natbib out-of-the-box,
but the following compatibility code makes it work:

\usepackage{achicago}
\let\achicagobib\thebibliography
\usepackage[authoryear]{natbib}
\let\thebibliography\achicagobib
\let\UnexpandableProtect\protect
\let\SCcite\astroncite
2013-01-05 00:08:55 +01:00
Juergen Spitzmueller
47673f560f Correctly initialize bool. Thanks, Pavel. 2012-10-11 12:55:43 +02:00
Juergen Spitzmueller
e2173f14ec Follow Lars' advice 2012-09-20 16:24:59 +02:00
Juergen Spitzmueller
ec078bd29d Do not search for empty string 2012-09-17 09:32:47 +02:00
Juergen Spitzmueller
e8a01d099a Calibrate log file parser
Filenames embraced in <...> can occur anywhere on the line and multiple times. This fixes for me the case that graphics included via ERT were not tracked. It probably also fixes #8336.

This is a candidate for branch.
2012-09-17 08:59:41 +02:00
Juergen Spitzmueller
ba792c4d35 Clarify the logic of fragmental file name checking
No change in functionality.
2012-09-17 07:37:49 +02:00
Jürgen Spitzmüller
d7266ac919 In recent biber version, the log message that tells us which bib files are used has been changed. Adapt the parser, so that bib files are tracked again.
This should go to BRANCH as well

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40542 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-23 09:24:31 +00:00
Jürgen Spitzmüller
ece9228f90 Fix biber execution om MikTeX.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39814 a592a061-630c-0410-9148-cb99ea01b6c8
2011-10-07 07:09:13 +00:00
Richard Heck
78fa6abc08 Fix for bug #7360. Patch from Nemah, posted to bug report.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38901 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-31 15:30:22 +00:00
Enrico Forestieri
1717ef203c Introduce the possibility of setting a prefix for the TEXINPUTS environment
variable. This is done in the preferences, much like as the PATH prefix.
A single '.' in the paths will get replaced with the current document dir
and also non-absolute paths will be prefixed with that dir.

The default semantics of TEXINPUTS apply, such that, for example, if a
path is terminated with a double slash, all subdirectories will be also
searched by both the TeX engine and ancillary programs such as dvi
previewers or dvips. As an example, if the prefix is set to ".:figs", the
TEXINPUTS variable will be set as ".:<docdir>:<docdir>/figs:$ORIGTEXINPUTS",
where <docdir> is the document directory.

The initial '.' is necessary to address the actual current dir (this will
be the temp dir at preview time), while if TEXINPUTS was initially unset,
such that $ORIGTEXINPUTS is empty, a colon (or semicolon on Windows) will
end the path list. This is very important, because we don't want to replace
the system directories but to complement them and, in order to do that, an
empty element has to be present in the list. Indeed, according to the
TEXINPUTS semantics, an empty element means the standard search path.
This works whether TEXINPUTS is originally set or not, because if the
original TEXINPUTS starts with a colon (meaning that the standard search
path is wanted there) we will have an empty element at that point,
otherwise the final colon will simply serve as a path separator.

Of course, on Windows a ';' has to be used as a path separator. LyX will
take care of transforming the platform path list into one understandable
by the TeX engine. For example, this will be the case for a Cygwin version
of LyX using a native Windows TeX engine or viceversa. I tested all of
this and it works for me.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38681 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-09 23:25:51 +00:00
Jürgen Spitzmüller
34651dfd6b * LaTeX.cpp: fix another variant of bug #7344 (delete aux files and rerun LaTeX if hyperref has been toggled)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37909 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-13 11:57:01 +00:00
Jürgen Spitzmüller
427b8e3f97 * LaTeX.cpp: fix bug #7344 (delete aux files and rerun LaTeX if hyperref has been toggled)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37883 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-08 15:14:13 +00:00
Enrico Forestieri
2e18f6a671 Fix bug #7331 (No error highlighting in child documents)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37845 a592a061-630c-0410-9148-cb99ea01b6c8
2011-03-04 13:37:14 +00:00
Jürgen Spitzmüller
14146a43fe * LaTeX.{cpp,h}:
- refine biber support: parse blg file to get the bib file into the dependency table with biber.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37581 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-10 10:09:59 +00:00
Jürgen Spitzmüller
f434f947dd * LaTeX.{cpp,h}: run biber if necessary (bug 7281).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37538 a592a061-630c-0410-9148-cb99ea01b6c8
2011-02-07 07:03:31 +00:00
Jürgen Spitzmüller
d469e5dd8b * LaTeX.cpp: recognize etaremune rerun request.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37311 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-24 09:47:58 +00:00
Jürgen Spitzmüller
0a34b1e047 fix some typos. Patch by Yuri Chornoivan.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37039 a592a061-630c-0410-9148-cb99ea01b6c8
2010-12-29 16:57:04 +00:00
Richard Heck
c5200a848e This one didn't make it to Unicode for some reason.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35761 a592a061-630c-0410-9148-cb99ea01b6c8
2010-10-21 19:15:31 +00:00
Jürgen Spitzmüller
be70a8eb11 * LaTeX.cpp: understand Biblatex's polite rerun request.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34822 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-09 08:40:03 +00:00
Peter Kümmel
615d42d357 TR1: use std::tr1 regex with msvc10
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34725 a592a061-630c-0410-9148-cb99ea01b6c8
2010-06-29 17:09:40 +00:00
Pavel Sanda
e1cabbf70e Last bits.
Trunk should be funcFileName consistent now.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34245 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-21 01:19:36 +00:00
Pavel Sanda
72a6c77a51 support:
frontends:
onlyFilename -> onlyFileName

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34240 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-21 01:19:28 +00:00
Pavel Sanda
62ca7f3ae5 Proper camel case for FileName.absFilename
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34234 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-21 01:19:09 +00:00
Pavel Sanda
a0aabe4ed9 Fix bug 6445: Incorrect TEX code causes misleading "File does not exist" error on "View PDF"
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33789 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-17 13:56:59 +00:00
Pavel Sanda
1fc1652f10 Fix bug 6593: LyX wont detect some pdftex errors
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33788 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-17 13:50:27 +00:00
Jürgen Spitzmüller
1c18269406 * LaTeX.cpp: update comment + typo.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32827 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-07 11:46:23 +00:00
Enrico Forestieri
b01b9b5e84 Fix bug #6258: LyX incorrectly interprets tetex warnings as errors.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31514 a592a061-630c-0410-9148-cb99ea01b6c8
2009-10-04 15:23:17 +00:00
Jürgen Spitzmüller
5f7c6b8964 * LaTeX.cpp (deplog):
- fix regex so that rexeg_search finds more than one match in a line.
	  This fixes a bug where files which were output in the log file in a 
	  line which already listed another file were not dependency tracked.
	  I.e., cases such as
	  (./child1.tex) (./child2.tex)
	  (bug 6024).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30198 a592a061-630c-0410-9148-cb99ea01b6c8
2009-06-20 13:02:12 +00:00
Jürgen Spitzmüller
7ba2bfb81d * Per-document setting for bibtex and makeindex.
File format change.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29774 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-22 07:20:00 +00:00
Enrico Forestieri
ccc77c73da Speed up FileName operator== (Georg's solution).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29498 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-02 17:12:31 +00:00
Jürgen Spitzmüller
d8396e9c7f * LaTeX.cpp: some debug output.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29256 a592a061-630c-0410-9148-cb99ea01b6c8
2009-04-16 08:33:43 +00:00
Jürgen Spitzmüller
c52bd08442 Introduce splitindex support. File format change.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29255 a592a061-630c-0410-9148-cb99ea01b6c8
2009-04-16 07:29:01 +00:00
Jürgen Spitzmüller
26b361417d * Properly separate the specific Japanese (i.e., pLaTeX) auxiliary programs (jbibtex, mendex)
from the standard LaTeX programs.
  These programs are only used now if the document actually uses Japanese, not always if they are found.
  (bug 5601 a.o.).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29238 a592a061-630c-0410-9148-cb99ea01b6c8
2009-04-13 09:53:40 +00:00
Jürgen Spitzmüller
4e61a40a92 * LaTeX.cpp:
- perform extra LaTeX run when requested by lettre.cls (bug 5818).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28828 a592a061-630c-0410-9148-cb99ea01b6c8
2009-03-17 05:09:18 +00:00
Jürgen Spitzmüller
b6938386a2 * LaTeX.cpp (run):
- perform an additional bibtex cycle if requested
	  (e.g. by Biblatex)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27724 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-28 12:54:29 +00:00
André Pönitz
f0a970a86e cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27534 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-16 12:53:49 +00:00
Abdelrazak Younes
7264a4a60c gcc warning fix, please verify.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27474 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-15 18:54:39 +00:00
André Pönitz
f1cba8ff64 more latin1..utf8 schanges. all of src/* should be utf8 now
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27425 a592a061-630c-0410-9148-cb99ea01b6c8
2008-11-14 15:58:50 +00:00
Jean-Marc Lasgouttes
cf7fdf78bb fix a bunch of harmless warnings
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26425 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-16 11:33:07 +00:00
Jürgen Spitzmüller
641708ac4b * separate nomencl processing command from index processing command, since nomencl
relies on makeindex (with specific options) [bug 5184].

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26226 a592a061-630c-0410-9148-cb99ea01b6c8
2008-08-23 09:44:00 +00:00
Abdelrazak Younes
2bf1c09376 header cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23049 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-18 07:14:42 +00:00