Addressing #10481.
This patch adds the new 'needauth' option for converters launching
external programs that are capable of running arbitrary code on behalf
of the user. These converters won't be run unless the user gives explicit
authorization, which is asked on-demand when the converter is about to
be run (question is not asked if the file is cached and calling the
converter is not needed).
The user prompt has a 3rd button so that he/she's not prompted again
for (any converter over) the same document (identified through
buffer->absFileName()).
Two preference options are added:
lyxrc.use_converter_needauth_forbidden disables any converter with
the 'needauth' option, which is meant to force user to an explicit
action via the preferences pane, before being able to use advanced
converters that can potentially bring security threats;
lyxrc.use_converter_needauth enables prompting the user for 'needauth'
converters, or bypasses the check if not enabled, falling back to the
previous behavior.
So, the first option is for maximum security, the second is for
maximum usability.
The differentiation of "xetex" and "platex" is not needed here,
is ambiguous and confusing (see #10013). The code that relies on
it can/should get its information otherwise.
Furthermore, polyglossia-exclusive languages now also work with
LuaTeX, since we support LuaTeX + polyglossia.
Boost.Signals is deprecated. This fixes bug #9943.
The only thing left to do is to rewrite (or get rid of) the boost -mt test
in config/lyxinclude.m4 not to use signals anymore.
The "save-as" part of the bug is fixed by extending the \textclass tag
such that, if a local layout file is used, its path relative to the
document directory is now stored together with the name. If a relative
path cannot be used, an absolute one is used but, in this case, the
document is not usable on a different platform.
The "copy" part is fixed by introducing a new \origin tag, which is
written when the file is saved. This tag stores the absolute path of
the document directory. If the document is manually copied to a
different location, the local layout file is retrivied by using
\origin (which is only updated on save).
This new tag may prove useful also for locating other files when the
document is manually moved to a different directory.
As in the original implementation the files needed for the layout
(for example, a latex class) had to be in the same directory as the
layout file, this directory has also to be added to TEXINPUTS.
As Enrico said, the user might have installed a package that was
missing (in which case the .tex file would not have changed).
Another reason is that changing some document settings did not
automatically lead to a fresh compile after an error (#9061).
Our old mechanism for detemining whether there was an error was to
check if the dependent file existed in the temporary directory. If
it did not exist, that meant it was removed, presumably because
there was an error during compilation. That mechanism cannot be used
anymore because we keep the files around even after error because of
the "Show Output Anyway" button (09700d5b). This commit implements a
more straightforward way of checking whether there was an error in
the previous preview by simply storing the success of last compile
in a buffer variable.
Imagemagick detects the inut file format based on contents. Therefore it does
not make sense that we prefix the to be converted file name with the extension
(assuming that the file extension matches the imagemagick format name). This
breaks formats where the extension used by LyX does not match the imagemagick
format name.
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
This was disabled in 2009 in bea0925f but it is now safe.
From Richard:
"I am pretty sure that all the work that Peter Kümmel did with the
InGuiThread classes dealt with this issue."
The many occurances of the mutable keyword in LyX sources make it quite
difficult to understand what is really const and what not, and to debug
multithreading memory problems. In this particular case it is not needed
at all to have a mutable member, so make it non-mutable.
Now the replacement is done in startScript(). In addition to making
the code cleaner and more consistent, this commit fixes a bug where
"$$s" was not replaced when "latex=" was specified in the extra flags
of a converter.
Note that the temporary fix at 731b8610 is reverted with this commit.
I had already noticed the above mentioned thinko and this commit
should have been part of [3285ce1d5/lygit] but somehow I managed
to lose it in the git branches game: do a branch for that, than
try a different thing in another branch, then rebase to avoid
merge conficts, and finally delete all unneeded branches. Well it
is too much easy to do the wrong thing and pick the wrong branch,
deleting the right one. I will never follow the git way anymore
and will do I was used to do with svn.
If a converter specifies the needaux flag, latex (or xelatex) is
always run to produce the needed auxiliary files. This is wrong
because there are documents that can only be compiled with a specific
backend and thus the conversion may fail. On the other hand, even if
the document specifies the backend to be used, LyX ignores this info.
This commit rectifies this behavior by letting LyX run the same flavor
of the latex backend that shall be used for previewing the document
also for producing the auxiliary files.
In this case, the inset parameters win in case there is any conflict. The only
exception is "type=eps", since I was too lazy to make the full keyval parser
of tex2lyx available to InsetGraphics in order to parse the special parameter.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40298 a592a061-630c-0410-9148-cb99ea01b6c8
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
to be a set. Not that speed will really be an issue here, but....
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38178 a592a061-630c-0410-9148-cb99ea01b6c8
since plain old latex will likely choke on the generated .tex file
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38168 a592a061-630c-0410-9148-cb99ea01b6c8
* in converters, make sure that $$p and $$r are slash-terminated paths (like in viwers, BTW)
* pass the full intput path to lyxsweave.R
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37337 a592a061-630c-0410-9148-cb99ea01b6c8
* Conerter.{cpp,h}:
- use a backend=flavor flag format for latex instead of hardcoding format names
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36623 a592a061-630c-0410-9148-cb99ea01b6c8