Bug in running external program (-shell-escape)
Jürgen Spitzmüller
jspitzm at gmail.com
Sat Mar 4 13:20:25 UTC 2023
Am Samstag, dem 04.03.2023 um 13:58 +0100 schrieb Mario D:
> Jurgen,
> maybe I didn't explain myself correctly.
I think you did.
> What I (the user) would expect to happen is that when I compile with
> Lyx then the files
>
> test-figure0.dpth
> test-figure0.log
> test-figure0.md5
> test-figure0.pdf
>
> get created in "$HOME/test/picts"
As I wrote, LaTeX does not allow this for security reasons. You can
only write file within the directory within which LaTeX is performed.
And this is the tmp directory.
There might be (latex) options to switch off this restrictions, but it
is there for good reasons. Consider a LaTeX file that can perform any
sort of command anywhere on your disk!
> This is, actually, what just happens if I export test.lyx to test.tex
> and then I compile it with
>
> pdflatex -shell-escape test.tex
Sure, since that's in the same tree.
> and this is what should happen (I think) also in Lyx, whereas when
> compiling in Lyx I get the message that the file cannot be created in
> the (already existing) directory.
No. See above.
> 3) the tmp dir has a dynamic name, so creating a symlink from there
> to "$HOME/test/picts" would not be feasible in a permanent way but
> should be done every time you start lyx and open your file, and this
> is quite annoying.
If you use
\usepackage{shellesc}
\ShellEscape{ln -s <workingdir>/picts picts}
this is done automatically every time the document is compiled in a new
tmp dir for the first time. What is annoying about this?
> All in all, it seems to me that there is a problem in the
> implementation of the external library in lyx: it writes the figure
> files (*.dpth, *.log, *.md5, *.pdf) assuming as root dir the document
> temp dir, something like
> /tmp/lyx_tmpdir.dJCMQsEYwFBx/lyx_tmpbuf0/
> whereas, in my opinion, it should use as root dir the dir the file
> lives in.
There are many reasons why we use the tmp dir. You are facing one
restriction of it, but as I have shown, it is solvable with not too
much intervention. For security reasons, we cannot make LyX handle
files like yours without any user intervention anyway.
I hope it is clearer now.
--
Jürgen
More information about the lyx-devel
mailing list