[latexrefman-commits] [SCM] latexrefman updated: r782 - trunk

karl at gnu.org.ua karl at gnu.org.ua
Sat Apr 4 01:00:49 CEST 2020


Author: karl
Date: 2020-04-04 02:00:48 +0300 (Sat, 04 Apr 2020)
New Revision: 782

Modified:
   trunk/ChangeLog
   trunk/latex2e.texi
Log:
\write18 interpreter

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2020-04-03 05:43:39 UTC (rev 781)
+++ trunk/ChangeLog	2020-04-03 23:00:48 UTC (rev 782)
@@ -1,3 +1,11 @@
+2020-04-03  Karl Berry  <karl at freefriends.org>
+
+	* latex2e.tex (\write): tweak menu descriptions.
+	(\write18): mention /bin/sh and cmd.exe; --enable-write18
+	supported by all distributions.
+	(Command line options): similarly; remove some duplication.
+	(throughout): @xref must be followed by punctuation.
+
 2020-04-03  Vincent Belaïche  <vincentb1 at users.sourceforge.net>
 
 	* latex2e.texi (Sectioning): in « *-form of sectioning commands »,

Modified: trunk/latex2e.texi
===================================================================
--- trunk/latex2e.texi	2020-04-03 05:43:39 UTC (rev 781)
+++ trunk/latex2e.texi	2020-04-03 23:00:48 UTC (rev 782)
@@ -16780,7 +16780,7 @@
 @anchor{includegraphics command}
 @item command
 Specify a command to be applied to this file.  Only use this in
-conjunction with the option @code{type}.  @xref{Command line options}
+conjunction with the option @code{type}.  @xref{Command line options},
 for a discussion of enabling the @code{\write18} functionality to run
 external commands.
 
@@ -19858,8 +19858,8 @@
 number of packages for this; one is @file{answers}.
 
 @menu
-* \message::          Write text to log file and terminal.
-* \wlog::             Write to the log file.
+* \message::          Write text to the log file and terminal.
+* \wlog::             Write text to the log file.
 * \write18::          Run an operating system command.
 @end menu
 
@@ -19971,7 +19971,7 @@
 finishes.
 
 @PkgIndex{Asymptote}
-This
+This sequence (on Unix)
 
 @example
 \usepackage@{graphicx@}  % in preamble
@@ -19982,11 +19982,11 @@
 @end example
 
 @noindent
-will run @file{Asymptote} on @file{pix/figure1.asy}, so that the
-document can later read in the resulting graphic
+will run Asymptote (the @code{asy} program) on @file{pix/figure1.asy},
+so that the document can later read in the resulting graphic
 (@pxref{\includegraphics}).  Like any @code{\write}, here @LaTeX{}
-expands macros in @var{shell_command} so that @code{\fignum} is replaced
-by @samp{1}.
+expands macros in @var{shell_command} so that @code{\fignum} is
+replaced by @samp{1}.
 
 Another example is that you can automatically run Bib at TeX{} at the start
 of each @LaTeX{} run (@pxref{Using BibTeX}) by including
@@ -20008,22 +20008,22 @@
 (@pxref{\write}). But sometimes you want it done now.  For this, use
 @code{\immediate\write18@{@var{shell_command}@}}.
 
-There are obvious security issues with allowing system commands inside a
- at LaTeX{} file.  If you download a file off the net and it contains
-commands to delete all your files then you would be annoyed. The
+There are obvious security issues with allowing system commands inside
+a @LaTeX{} file.  If you download a file off the net and it contains
+commands to delete all your files then you would be unhappy. The
 standard settings in modern distributions turn off full shell
-access. You can turn it on, if you are sure the shell commands are safe,
-by compiling with @code{latex --shell-escape @var{filename}} for @TeX{}
-Live or Mac at TeX{} or @code{latex --enable-write18 @var{filename}} for
-MiK at TeX{} (@pxref{Command line options}).
+access. You can turn it on, if you are sure the shell commands are
+safe, by compiling with @code{latex --enable-write18 @var{filename}}
+(@pxref{Command line options}).  (The @code{--shell-escape} option is
+a synonym, in @TeX{} Live.)
 
 @cindex restricted shell access
-In the place of full shell access, modern distributions by default use a
-restricted version that allows some commands to work, such as those that
-run Metafont to generate missing fonts, even if you do not use the
- at code{shell-escape} or @code{enable-write18} option. By default this
-list of allowed commands is short and features only commands that are
-under the control of the distribution maintainers (@pxref{Command line
+In the place of full shell access, modern distributions by default use
+a restricted version that allows some commands to work, such as those
+that run Metafont to generate missing fonts, even if you do not use
+the @code{enable-write18} option. By default this list of allowed
+commands is short and features only commands that are under the
+control of the distribution maintainers (@pxref{Command line
 options}).
 
 Some packages need to run external system commands. For instance
@@ -20032,12 +20032,21 @@
 output in your document. For this you must run @LaTeX{} with full
 @code{\write18} capability turned on.
 
- at PkgIndex{texosquery} If what you need is system information, such as
-the operating system name, locale information, or directory contents,
-take a look at the @file{texosquery} package, which provides a
-convenient and secure interface for this:
- at url{https://ctan.org/pkg/texosquery}.
+ at findex sh at r{, used by @code{\write18}}
+ at findex cmd.exe at r{, used by @code{\write18}}
+The @var{shell_command} text is always passed to @file{/bin/sh} on
+Unix-like operating systems, and the DOS command interpreter
+ at file{cmd.exe} on Windows. Any different shell set by the user, and
+the @code{SHELL} environment variable, is ignored.
 
+ at PkgIndex{texosquery}
+If what you need is system information, such as the operating system
+name, locale information, or directory contents, take a look at the
+ at file{texosquery} package, which provides a convenient and secure
+interface for this, unlike the above examples using the raw
+ at code{\write18}: @url{https://ctan.org/pkg/texosquery}.
+
+
 @node Command line
 @chapter Command line
 
@@ -20161,7 +20170,7 @@
 @code{\input} instruction and the name of the input file will be the job
 name. This is used to name the log file the output file.  The
 @code{jobname} option overrides that process and directly specifies the
-name.  @xref{Command line input} for an example of its use.
+name.  @xref{Command line input}, for an example of its use.
 
 @anchor{output directory}
 @cindex output directory for all external files
@@ -20180,31 +20189,26 @@
 checked for input files.
 
 @cindex shell escape
+ at cindex @code{\write18}, enabling
+ at findex --enable-write18 @r{command-line option}
+ at findex --disable-write18 @r{command-line option}
 @findex --shell-escape @r{command-line option}
 @findex --no-shell-escape @r{command-line option}
- at findex --enable-write18 @r{command-line option}
- at findex --disable-write18 @r{command-line option}
- at item --shell-escape
+ at item --enable-write18
+ at itemx --disable-write18
+ at itemx --shell-escape
 @itemx --no-shell-escape
- at itemx --enable-write18
- at itemx --disable-write18
 Enable or disable @code{\write18@{@var{shell_command}@}}
-(@pxref{\write18}).  The first two options are for with @TeX{} Live or
-Mac at TeX{} while the second two are for MiK at TeX{}.
+(@pxref{\write18}).  The first two options are supported by both
+ at TeX{} Live and MiK at TeX{}, while the second two are synonyms supported
+by @TeX{} Live.
 
- at PkgIndex{sagetex}
-Sometimes you want to run external system commands from inside a
- at LaTeX{} file. For instance the package @file{sagetex} allows you to
-have the mathematics software system @i{Sage} do calculations or draw
-graphs and then incorporate that output in your document.  For this
- at TeX{} provides the @code{\write18} command.
+Enabling this functionality has major security implications, since it
+allows a @LaTeX{} file to run any command whatsoever.  Thus, by
+default, unrestricted @code{\write18} is not allowed.  (The default
+for @TeX{} Live, Mac at TeX{}, and MiK at TeX{} is to allow the execution of
+a limited number of @TeX{}-related programs, which they distribute.)
 
-But with this functionality enabled, security issues could happen if
-you compiled a @LaTeX{} file from the Internet.  By default,
-unrestricted @code{\write18} is not allowed.  (The default for @TeX{}
-Live, Mac at TeX{}, and MiK at TeX{} is to allow the execution of a limited
-number of @TeX{}-related programs, which they distribute.)
-
 For example, if you invoke @LaTeX{} with the option
 @code{no-shell-escape}, and in your document you call
 @code{\write18@{ls -l@}}, then you do not get an error but the log



More information about the latexrefman-commits mailing list.