27

I've installed a backported version of TL2012 on Ubuntu 12.04, and every time I start pdftex, xetex, luatex, pdflatex, xelatex, or lualatex, I get the statement restricted \write18 enabled. entering extended mode. I don't recall seeing this in Miktex so I wonder whether I did something wrong during the installation. Interestingly, I don't get the message when I run tex.

First of all, what does it mean? Second, is it a normal message for Tex Live (2012)? Finally, if it is an error, how can I fix it?

29

For years \write18 has been used as a back door to the operating system. Syntactically TeX treats it as writing to a file, but register 18 is treated as a pre-opened file that in fact executes commands.

"unrestricted" write18 means that you can execute any command so if you allow this and run a TeX file that someone sent you it may execute arbitrary code, email your password file to a spam bot or whatever.

That is obviously a security risk but there are some commands that are naturally part of the Tex distribution that you might want to always allow (such as image and font conversion) so web2c allows you (or the texlive maintainers by default) to set up a set of "allowed, safe" commands and these are allowed to run in restricted mode.

The third alternative is never to execute commands at all from \write18.

  • 1
    when I compile in terminal using pdflatex it prints \write18 and continues compiling. But, in a java programm made by when I run command like pdflatex sample.tex it prints \write18 and hang that point. What can I do? – alhelal Nov 2 '17 at 15:45
  • @alhelal please don't ask new questions in comments on old answers, you would need to ask a new question with an example (impossible to guess what is wrong otherwise) but it sounds more like a java question rather than tex, so perhaps stackoverflow might be better – David Carlisle Nov 2 '17 at 15:50
  • 1
    @DavidCalisle this solves by a option -no-shell-escape. – alhelal Nov 2 '17 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.