diff options
Diffstat (limited to 'Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-spawnprog.html')
-rw-r--r-- | Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-spawnprog.html | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-spawnprog.html b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-spawnprog.html new file mode 100644 index 00000000000..0d0f1e1ae09 --- /dev/null +++ b/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-spawnprog.html @@ -0,0 +1,63 @@ +<head> +<title>UK TeX FAQ -- question label spawnprog</title> +</head><body> +<h3>Spawning programs from (La)TeX: <code>\</code><code>write18</code></h3> +<p/>The TeX <a href="FAQ-write.html"><code>\</code><code>write</code> primitive instruction</a> is used +to write to different file ‘streams’; TeX refers to each open file by +a number, not by a file name (although most of the time we hide this). +Originally, TeX would write to a file connected to a stream +numbered 0–15. More recently, a special “stream 18” has been +implemented: it is not writing to a file, but rather tells TeX to ask +the operating system to do something. To run a command, we put it as +the argument to <code>\</code><code>write18</code>. So to run the <i>epstopdf</i> +program on a file with name stored as <code>\</code><code>epsfilename</code>, we would +write: +<blockquote> +<pre> +\write18{epstopf \epsfilename} +</pre> +</blockquote><p> +When using something like the <i>epstopdf</i> package, the ‘stream’ +write operation is hidden away and you don’t need to worry about the +exact way it’s done. +<p/>However, there is a security issue. If you download some (La)TeX code from +the Internet, can you be sure that there is not some command in it +(perhaps in a hidden way) to do stuff that might be harmful to your +PC (let’s say: delete everything on the hard disk!)? In the +face of this problem, both MiKTeX and TeX Live have, for some +time, disabled <code>\</code><code>write18</code> by default. To turn the facility on, +both distributions support an additional argument when starting TeX +from the command shell: +<blockquote> +<pre> +(pdf)(la)tex --shell-escape <file> +</pre> +</blockquote><p> +The problem with this is that many people use (La)TeX via a graphical +editor, so to use <code>\</code><code>write18</code> for a file the editor’s settings must +be changed. Of course, the settings need restoring after the file is +processed: you defeat the point of the original protection, that way. +<p/>The latest MiKTeX (version 2.9), and TeX Live (2010 release) get +around this by having a special “limited” version of <code>\</code><code>write18</code> +enabled ‘out of the box’. The idea is to allow only a pre-set list of +commands (for example, BibTeX, <i>epstopdf</i>, TeX itself, +and so on). Those on the list are regarded as safe enough to allow, +whereas anything else (for example deleting files) still needs to be +authorised by the user. This seems to be a good balance: most people +most of the time will not need to worry about <code>\</code><code>write18</code> at all, +but it will be available for things like <i>epstopdf</i>. +<p/>Note that the TeX system may tell you that the mechanism is in use: +<blockquote> +<pre> +This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010) + restricted \write18 enabled. +</pre> +</blockquote><p> + +when it starts. +<dl> +<dt><tt><i>epstopdf.sty</i></tt><dd>Distributed with Heiko Oberdiek’s packages + <a href="http://mirror.ctan.org/macros/latex/contrib/oberdiek.zip">macros/latex/contrib/oberdiek</a> (or <a href="http://mirror.ctan.org/macros/latex/contrib/oberdiek/">browse the directory</a>); <a href="http://mirror.ctan.org/help/Catalogue/entries/oberdiek.html">catalogue entry</a> +</dl> +<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=spawnprog">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=spawnprog</a> +</body> |