diff options
author | Karl Berry <karl@freefriends.org> | 2009-02-26 19:44:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-02-26 19:44:17 +0000 |
commit | fd209ee79002d0d87c3835c8e2697ed0eb7cc53c (patch) | |
tree | 4e2d10d678beb337d03b525d939068b6ebb55b24 /Build/source/texk/web2c/doc | |
parent | 6226ce8e1a87017d3c958d63660c83b669e4da9a (diff) |
new restricted mode for \write18
git-svn-id: svn://tug.org/texlive/trunk@12244 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/doc')
-rw-r--r-- | Build/source/texk/web2c/doc/web2c.info | 348 | ||||
-rw-r--r-- | Build/source/texk/web2c/doc/web2c.texi | 190 |
2 files changed, 346 insertions, 192 deletions
diff --git a/Build/source/texk/web2c/doc/web2c.info b/Build/source/texk/web2c/doc/web2c.info index c10f40efd81..51a0b5aadbc 100644 --- a/Build/source/texk/web2c/doc/web2c.info +++ b/Build/source/texk/web2c/doc/web2c.info @@ -1,4 +1,4 @@ -This is web2c.info, produced by makeinfo version 4.12 from web2c.texi. +This is web2c.info, produced by makeinfo version 4.13 from web2c.texi. INFO-DIR-SECTION TeX START-INFO-DIR-ENTRY @@ -62,7 +62,7 @@ Web2c This document describes how to install and use the programs in the Web2c implementation of the TeX system, especially for Unix systems. It -corresponds to Web2c version 7.5.7, released in July 2008. +corresponds to Web2c version 7.5.7, released in February 2009. * Menu: @@ -87,7 +87,7 @@ File: web2c.info, Node: Introduction, Next: Installation, Prev: Top, Up: Top ************** This manual corresponds to version 7.5.7 of Web2c, released in -July 2008. +February 2009. "Web2c" is the name of a TeX implementation, originally for Unix, but now also running under DOS, Amiga, and other operating systems. By @@ -934,6 +934,7 @@ are available. * Initial TeX:: Making format files. * Formats:: Major TeX macro packages. * Languages and hyphenation:: TeX supports many human languages. +* Shell escapes:: DVI output to a socket. * IPC and TeX:: DVI output to a socket. * TeX extensions:: Changes to the TeX language. @@ -1065,21 +1066,10 @@ suffice.) `-shell-escape' `-no-shell-escape' - Enable (or disable) the `\write18{SHELL-COMMAND}' feature. This - is also enabled if the environment variable or config file value - `shell_escape' is set to `t' (but the `-no-shell-escape' command - line option overrides this). (For backwards compatibility, `y' - and `1' are accepted as synonyms of `t'). It is disabled by - default to avoid security problems. When enabled, the - SHELL-COMMAND string (which first undergoes the usual TeX - expansions, just as in `\special') is passed to the command shell - (via the C library function `system'). The output of - SHELL-COMMAND is not diverted anywhere, so it will not appear in - the log file. The system call either happens at `\output' time or - right away, according to the absence or presence of the - `\immediate' prefix, as usual for `\write'. (If you as a TeX - administrator wish to implement more stringent rules on what can - be executed, you will need to modify `tex.ch'.) +`-shell-restricted' + Enable, or disable, or enable with restrictions the + `\write18{SHELL-COMMAND}' feature for external executing shell + commands. *Note Shell escapes::. `-src-specials' `-src-specials=STRING' @@ -1214,7 +1204,7 @@ slitex -File: web2c.info, Node: Languages and hyphenation, Next: IPC and TeX, Prev: Formats, Up: TeX +File: web2c.info, Node: Languages and hyphenation, Next: Shell escapes, Prev: Formats, Up: TeX 4.4 Languages and hyphenation ============================= @@ -1472,13 +1462,89 @@ Frank Liang (*note References::), and also the `patgen.web' source file. The only options are `-help' and `-version' (*note Common options::). -File: web2c.info, Node: IPC and TeX, Next: TeX extensions, Prev: Languages and hyphenation, Up: TeX +File: web2c.info, Node: Shell escapes, Next: IPC and TeX, Prev: Languages and hyphenation, Up: TeX -4.5 IPC and TeX +4.5 Shell escapes +================= + +TeX can execute "shell escapes", that is, arbitrary shell commands. +Although tremendously useful, this also has obvious security +implications. Therefore, as of TeX Live 2009, a "restricted" mode for +shell escapes is the default mode of operation, which allows executing +only certain commands, as specified in the `texmf.cnf' configuration +file. + + * Unrestricted shell escapes are allowed if the option + `--shell-escape' is specified, or if the environment variable or + config file value `shell_escape' is set to `t' or `y' and `1'. + + * Restricted shell escapes are allowed if `shell_escape' is set to + `p'. This is the default. + + * Shell escapes are completely disabled if `--no-shell-escape' is + specified, or if `shell_escape' is set to anything else. + + When enabled, the TeX construct to execute a system command is +`\write18{SHELL-COMMAND}'; for example: + + \write18{echo "hello, world"} + + From TeX's point of view, this is a normal `\write' command, and is +therefore subject to the usual TeX expansions. Also, the system call +either happens during the `\output' routine or right away, according to +the absence or presence of the `\immediate' prefix, as usual for +`\write'. + + The SHELL-COMMAND string is passed to the command shell (via the C +library function `system'). The output of SHELL-COMMAND is not +diverted anywhere, so it will not appear in the log file, or anywhere +but the terminal output. The exit status of the system call is also +not available to TeX. + + In unrestricted mode, the argument is simply passed straight to +`system' unaltered. + + In restricted mode, ASCII double quote characters (") should always +be used in the argument to `\write18' where quoting of arguments is +needed, as in the example above. This is to achieve some measure of +system independence. On Unix systems, these are replaced with single +quote (') characters to avoid insecure further expansion. Care is also +taken on Windows to avoid additional expansions (from, e.g., `...`). +Mismatched quotation marks in the command string result in a diagnostic +message in the log file; no execution is performed. + + After quotation processing, if the first word (delimited by a space +or tab) of the command is in the list specified by the +`shell_escape_commands' configuration value, the command is executed. +Otherwise it is not. In any case, a message is written to the log file. + + The `shell_escape_commands' value is a comma-separated list of +words. Whitespace is significant, and typically should not be present. +The default definition looks like this, but with more commands included: + + shell_escape_commands = bibtex,dvips,epstopdf,...,tex + + pdfTeX and luaTeX support reading (via `\input' and `\openin') and +writing (via `\openout') from pipes if the first character is `|'. The +following command is then treated exactly the same as the argument to +`\write18'. In these engines, the primitive variable `\pdfshellescape' +is set to 0 if shell escapes are disabled, 1 if they are enabled, and 2 +if they are enabled with restrictions. + + The purpose of this feature is to make it possible for TeX documents +to perform useful external actions in the common case of an individual +user running a known document on his or her own machine. In such +environments as CGI scripts or wikis where the input has to be +considered untrustworthy, shell escapes should be completely disabled. + + +File: web2c.info, Node: IPC and TeX, Next: TeX extensions, Prev: Shell escapes, Up: TeX + +4.6 IPC and TeX =============== -(Sorry, but I'm not going to write this unless someone actually uses -this feature. Let me know.) +(If anyone uses this feature and needs documentation, write +<tex-k@tug.org>.) This functionality is available only if the `--enable-ipc' option was specified to `configure' during installation of Web2c (*note @@ -1491,38 +1557,34 @@ its socket operations. This may be helpful if you are, well, debugging. File: web2c.info, Node: TeX extensions, Prev: IPC and TeX, Up: TeX -4.6 TeX extensions +4.7 TeX extensions ================== The base TeX program has been extended in many ways. Here's a partial -list. Please send information on extensions not listed here to the -address in *note Reporting bugs: (kpathsea)Reporting bugs. +list. e-TeX - Adds many new primitives, including right-to-left typesetting. - Available from `http://www.vms.rhbnc.ac.uk/e-TeX/' and - `CTAN:/systems/e-tex'. + Adds many new primitives, including right-to-left typesetting and + more registers. Now frozen. Omega - Adds Unicode support, right-to-left typesetting, and more. - Available from `http://www.ens.fr/omega' and `CTAN:/systems/omega'. +Aleph + These add Unicode support, right-to-left typesetting, and more. + Omega was the original program. Aleph is an updated version with + a variety of bug fixes, and includes e-TeX. Neither is actively + maintained. pdfTeX - A variant of TeX that produces PDF instead of DVI files. It also - includes primitives for hypertext and micro-typography. Available - from `CTAN:/systems/pdftex'. - -`TeX--XeT' - Adds primitives and DVI opcodes for right-to-left typesetting (as - used in Arabic, for example). An old version for TeX 3.1415 is - available from `CTAN:/systems/knuth/tex--xet'. A newer version is - included in e-TeX. - -File-handling TeX - Adds primitives for creating multiple DVI files in a single run; - and appending to output files as well as overwriting. Web2c - implementation available in the distribution file - `web2c/contrib/file-handling-tex'. + Can produce PDF as well as DVI files. It also incorporates the + e-TeX extensions, new primitives for hypertext and + micro-typography, reading/writing from pipes, and much more. Home + page: `http://pdftex.org'. + +luaTeX + Based on pdfTeX, this also embeds the Lua programming language + (`http://lua.org') and opens up the TeX typesetting engine to + control from Lua. Home page: `http://luatex.org'. + File: web2c.info, Node: Metafont, Next: MetaPost, Prev: TeX, Up: Top @@ -3781,6 +3843,7 @@ Index * -progname=STRING: Common options. (line 83) * -recorder: Common options. (line 90) * -shell-escape: tex invocation. (line 127) +* -shell-restricted: tex invocation. (line 129) * -show-opcodes: dvitype invocation. (line 56) * -strict: tangle invocation. (line 46) * -style=MFTFILE: mft invocation. (line 68) @@ -3829,15 +3892,20 @@ Index * \countN: dvicopy invocation. (line 28) * \font and dynamic generation: tex invocation. (line 44) * \fontdimen: tftopl invocation. (line 100) -* \immediate\write18: tex invocation. (line 128) +* \immediate\write18: Shell escapes. (line 6) * \input filenames: \input filenames. (line 6) +* \input, and pipes: Shell escapes. (line 63) * \mag <1>: dvitype invocation. (line 28) * \mag: dvicopy invocation. (line 20) +* \openin, and pipes: Shell escapes. (line 63) * \openout and security: tex invocation. (line 51) +* \openout, and pipes: Shell escapes. (line 63) +* \output routine, and \write: Shell escapes. (line 28) +* \pdfshellescape: Shell escapes. (line 63) * \string: \input filenames. (line 60) * \tracingcharsubdef and MLTeX: \tracingcharsubdef. (line 6) * \tracinglostchars and MLTeX: \tracingcharsubdef. (line 11) -* \write18 shell escape extension: tex invocation. (line 128) +* \write18 shell escape extension: Shell escapes. (line 6) * ^^ notation, avoiding: TCX files. (line 88) * `Computer Modern Typefaces', production of: mft invocation. (line 75) * abbrv.bst: Basic BibTeX style files. @@ -3862,7 +3930,6 @@ Index * AMSTeX: Formats. (line 39) * apalike.bst: Basic BibTeX style files. (line 25) -* Arabic typesetting: TeX extensions. (line 25) * architecture dependencies: Hardware and memory dumps. (line 6) * array limit, fixed: Runtime options. (line 36) @@ -3902,7 +3969,6 @@ Index (line 6) * binaries, linking: Common options. (line 83) * blank lines, in TCX files: TCX files. (line 67) -* Bourne shell commands in TeX: tex invocation. (line 128) * boxes, memory for: Runtime options. (line 20) * breakpoints, memory for: Runtime options. (line 20) * Breitenlohner, Peter: Introduction. (line 9) @@ -4011,7 +4077,6 @@ Index * dumping memory: Memory dumps. (line 6) * DVI comment, specifying: tex invocation. (line 120) * DVI files, converting to MPX: dvitomp invocation. (line 6) -* DVI files, creating multiple: TeX extensions. (line 31) * DVI files, explained: Font file formats. (line 30) * DVI format definition: DVI utilities. (line 14) * DVI opcodes, showing: dvitype invocation. (line 56) @@ -4032,7 +4097,7 @@ Index * dynamic packing variable: pktype invocation. (line 44) * e response at error prompt: Editor invocation. (line 6) * e-circumflex: \charsubdef. (line 21) -* e-TeX: TeX extensions. (line 11) +* e-TeX: TeX extensions. (line 10) * e.mft: mft invocation. (line 75) * EC fonts <1>: mf invocation. (line 24) * EC fonts: tex invocation. (line 44) @@ -4054,6 +4119,7 @@ Index * etex and label extraction: mpto invocation. (line 6) * etex for MetaPost labels: mpost invocation. (line 50) * executables, shared initial and virgin: Initial and virgin. (line 6) +* exit status, of shell escape: Shell escapes. (line 34) * expanded plain format: Formats. (line 54) * extensions to TeX: TeX extensions. (line 6) * extra_mem_bot: Runtime options. (line 19) @@ -4063,7 +4129,6 @@ Index * file formats for fonts: Font file formats. (line 6) * file mtimes, comparing: newer invocation. (line 6) * file recorder: Common options. (line 90) -* File-handling TeX: TeX extensions. (line 31) * filename conventions, in input files: \input filenames. (line 6) * filenames starting with -: Option conventions. (line 19) * first line of the main input file: Common options. (line 96) @@ -4107,7 +4172,7 @@ Index * Free Software Foundation documentation system: Formats. (line 47) * freedom of Web2c: Introduction. (line 23) * ftp.math.utah.edu: bibtex invocation. (line 54) -* generating source specials: tex invocation. (line 146) +* generating source specials: tex invocation. (line 135) * geometric designs: Metafont. (line 6) * geometric font scaling: Font file formats. (line 22) * geometry for Metafont: Online Metafont graphics. @@ -4160,6 +4225,7 @@ Index * human-readable text, converting PK to: pktype invocation. (line 6) * human-readable text, converting TFM to: tftopl invocation. (line 6) * human-readable text, converting VF to: vftovp invocation. (line 6) +* hypertext: TeX extensions. (line 21) * hyphenation and languages: Languages and hyphenation. (line 6) * hyphenation patterns, creating: patgen invocation. (line 6) @@ -4225,6 +4291,8 @@ Index * LittleEndian machines: Hardware and memory dumps. (line 6) * log file, BibTeX: bibtex invocation. (line 14) +* Lua: TeX extensions. (line 27) +* luaTeX: TeX extensions. (line 27) * machine dependencies: Hardware and memory dumps. (line 6) * machine-readable, converting property lists to <1>: vptovf invocation. @@ -4300,6 +4368,7 @@ Index * MFTERM: Online Metafont graphics. (line 11) * mftmac.tex: mft invocation. (line 6) +* micro-typography: TeX extensions. (line 21) * mktexmf, disabling: mf invocation. (line 24) * mktextfM, disabling: tex invocation. (line 44) * mltex: MLTeX. (line 6) @@ -4337,7 +4406,6 @@ Index * mpxerr.tex: makempx invocation. (line 34) * mtimes of files, comparing: newer invocation. (line 6) * Multi-lingual TeX: MLTeX. (line 6) -* multiple DVI files, creating: TeX extensions. (line 31) * N tilde: \charsubdef. (line 37) * new graphics support for Metafont: Online Metafont graphics. (line 77) @@ -4353,7 +4421,7 @@ Index * octal character codes, in TCX files: TCX files. (line 78) * offset for overflow labels: gftodvi invocation. (line 59) * older-than, file comparisons: newer invocation. (line 6) -* Omega: TeX extensions. (line 16) +* Omega: TeX extensions. (line 15) * online Metafont graphics: Online Metafont graphics. (line 6) * opcodes, showing DVI: dvitype invocation. (line 56) @@ -4376,8 +4444,8 @@ Index * patgen: patgen invocation. (line 6) * path searching: Path searching. (line 6) * path searching debugging: Common options. (line 60) -* PDF: TeX extensions. (line 20) -* pdfTeX: TeX extensions. (line 20) +* PDF: TeX extensions. (line 21) +* pdfTeX: TeX extensions. (line 21) * permissions, legal: Legalisms. (line 6) * PFA and PFB conversion: Font utilities available elsewhere. (line 39) @@ -4385,6 +4453,7 @@ Index (line 30) * PiCTeX, increasing memory for: Runtime options. (line 20) * picture expressions: makempx invocation. (line 43) +* pipes, reading and writing: Shell escapes. (line 63) * pixel height: pktype invocation. (line 62) * pixel width: pktype invocation. (line 62) * PK bitmaps from PostScript: Font utilities available elsewhere. @@ -4431,7 +4500,7 @@ Index * predefined macros and memory dumps: Memory dumps. (line 6) * prettyprinting Metafont source: mft invocation. (line 6) * prettyprinting WEB programs: weave invocation. (line 6) -* primitives, new: TeX extensions. (line 11) +* primitives, new: TeX extensions. (line 10) * printable characters, specifying: TCX files. (line 88) * printer characteristics, for Metafont: Modes. (line 6) * production use: Initial and virgin. (line 20) @@ -4468,9 +4537,9 @@ Index * regression testing: tex invocation. (line 120) * repeated rows: pktype invocation. (line 76) * representation of strings: pooltype invocation. (line 30) +* restricted shell escapes: Shell escapes. (line 6) * right side bearing <1>: gftype invocation. (line 82) * right side bearing: pktype invocation. (line 66) -* right-to-left typesetting: TeX extensions. (line 25) * Rokicki, Tomas: Introduction. (line 41) * run length encoded bitmaps <1>: gftype invocation. (line 89) * run length encoded bitmaps: pktype invocation. (line 76) @@ -4482,13 +4551,14 @@ Index (line 42) * security, and \openout: tex invocation. (line 51) * security, and output files: tex invocation. (line 51) -* security, and shell escapes: tex invocation. (line 128) +* security, and shell escapes: Shell escapes. (line 6) * SetColor ditroff command: dmp invocation. (line 15) * shapes: Metafont. (line 6) * sharing memory dumps: Hardware and memory dumps. (line 6) -* shell commands in TeX: tex invocation. (line 128) -* shell_escape enabling in TeX: tex invocation. (line 128) +* shell commands in TeX: Shell escapes. (line 6) +* shell_escape enabling in TeX: Shell escapes. (line 6) +* shell_escape_commands: Shell escapes. (line 52) * siam.bst: Basic BibTeX style files. (line 35) * side bearings <1>: gftype invocation. (line 82) @@ -4526,7 +4596,8 @@ Index * swapping bytes: Hardware and memory dumps. (line 13) * syntax of TCX files: TCX files. (line 66) -* system C library function: tex invocation. (line 128) +* system C library function: Shell escapes. (line 6) +* system command: Shell escapes. (line 6) * T1 encoding and ISO input: TCX files. (line 49) * Tachikawa, Elizabeth: Font file formats. (line 63) * tangle: tangle invocation. (line 6) @@ -4555,7 +4626,6 @@ Index * TeX, invocation: tex invocation. (line 6) * TeX, Metafont, and MetaPost: Three programs. (line 6) * TeX, Web2c implementation of: Introduction. (line 9) -* TeX--XeT: TeX extensions. (line 25) * tex.fmt: Initial TeX. (line 15) * TEXBIB, search path for bib files: bibtex invocation. (line 18) * TEXEDIT: Editor invocation. (line 10) @@ -4611,7 +4681,7 @@ Index * typeface specimen sheets: Font utilities available elsewhere. (line 42) * typesetting: TeX. (line 6) -* Unicode: TeX extensions. (line 16) +* Unicode: TeX extensions. (line 15) * Unicode input: tex invocation. (line 95) * uniterm: Online Metafont graphics. (line 50) @@ -4640,6 +4710,7 @@ Index * vptovf: vptovf invocation. (line 6) * weave: weave invocation. (line 6) * WEB: WEB. (line 6) +* web environments, and security: Shell escapes. (line 70) * WEB pool files, displaying: pooltype invocation. (line 6) * WEB programs, compiling: tangle invocation. (line 6) * WEB programs, typesetting: weave invocation. (line 6) @@ -4689,77 +4760,78 @@ Index Tag Table: Node: Top3053 -Node: Introduction4048 -Node: Installation7225 -Node: configure options9389 -Node: Compile-time options11471 -Node: Additional targets12597 -Node: Triptrap13878 -Node: Runtime options15407 -Node: Commonalities17179 -Node: Option conventions17784 -Node: Common options19008 -Node: Path searching23520 -Node: Output file location24542 -Node: Three programs25582 -Node: Initial and virgin26341 -Node: Memory dumps27441 -Node: Creating memory dumps27908 -Node: Determining the memory dump to use29169 -Node: Hardware and memory dumps30793 -Node: Editor invocation33262 -Node: \input filenames33992 -Node: TeX36985 -Node: tex invocation38075 -Node: Initial TeX46007 -Node: Formats47496 -Node: Languages and hyphenation50435 -Node: MLTeX50863 -Node: \charsubdef52358 -Node: \tracingcharsubdef54684 -Node: TCX files55259 -Node: patgen invocation60683 -Node: IPC and TeX61400 -Node: TeX extensions62001 -Node: Metafont63302 -Node: mf invocation64590 -Node: Initial Metafont68473 -Node: Modes70226 -Node: Online Metafont graphics72481 -Node: gftodvi invocation75754 -Node: mft invocation78576 -Node: MetaPost82631 -Node: mpost invocation83652 -Node: Initial MetaPost88837 -Node: makempx invocation90648 -Node: dvitomp invocation94653 -Node: dmp invocation95424 -Node: mpto invocation99445 -Node: newer invocation100427 -Node: BibTeX101364 -Node: bibtex invocation101725 -Node: Basic BibTeX style files104050 -Node: WEB105392 -Node: tangle invocation106675 -Node: weave invocation108798 -Node: pooltype invocation110206 -Node: DVI utilities111336 -Node: dvicopy invocation112280 -Node: dvitype invocation113578 -Node: dvitype output example115933 -Node: Font utilities118984 -Node: Font file formats120164 -Node: gftopk invocation123463 -Node: pktogf invocation124667 -Node: pktype invocation125846 -Node: gftype invocation128681 -Node: tftopl invocation133197 -Node: pltotf invocation137831 -Node: vftovp invocation138896 -Node: vptovf invocation141180 -Node: Font utilities available elsewhere142234 -Node: Legalisms144642 -Node: References146813 -Node: Index151198 +Node: Introduction4052 +Node: Installation7233 +Node: configure options9397 +Node: Compile-time options11479 +Node: Additional targets12605 +Node: Triptrap13886 +Node: Runtime options15415 +Node: Commonalities17187 +Node: Option conventions17792 +Node: Common options19016 +Node: Path searching23528 +Node: Output file location24550 +Node: Three programs25590 +Node: Initial and virgin26349 +Node: Memory dumps27449 +Node: Creating memory dumps27916 +Node: Determining the memory dump to use29177 +Node: Hardware and memory dumps30801 +Node: Editor invocation33270 +Node: \input filenames34000 +Node: TeX36993 +Node: tex invocation38139 +Node: Initial TeX45264 +Node: Formats46753 +Node: Languages and hyphenation49692 +Node: MLTeX50122 +Node: \charsubdef51617 +Node: \tracingcharsubdef53943 +Node: TCX files54518 +Node: patgen invocation59942 +Node: Shell escapes60659 +Node: IPC and TeX64223 +Node: TeX extensions64793 +Node: Metafont65772 +Node: mf invocation67060 +Node: Initial Metafont70943 +Node: Modes72696 +Node: Online Metafont graphics74951 +Node: gftodvi invocation78224 +Node: mft invocation81046 +Node: MetaPost85101 +Node: mpost invocation86122 +Node: Initial MetaPost91307 +Node: makempx invocation93118 +Node: dvitomp invocation97123 +Node: dmp invocation97894 +Node: mpto invocation101915 +Node: newer invocation102897 +Node: BibTeX103834 +Node: bibtex invocation104195 +Node: Basic BibTeX style files106520 +Node: WEB107862 +Node: tangle invocation109145 +Node: weave invocation111268 +Node: pooltype invocation112676 +Node: DVI utilities113806 +Node: dvicopy invocation114750 +Node: dvitype invocation116048 +Node: dvitype output example118403 +Node: Font utilities121454 +Node: Font file formats122634 +Node: gftopk invocation125933 +Node: pktogf invocation127137 +Node: pktype invocation128316 +Node: gftype invocation131151 +Node: tftopl invocation135667 +Node: pltotf invocation140301 +Node: vftovp invocation141366 +Node: vptovf invocation143650 +Node: Font utilities available elsewhere144704 +Node: Legalisms147112 +Node: References149283 +Node: Index153668 End Tag Table diff --git a/Build/source/texk/web2c/doc/web2c.texi b/Build/source/texk/web2c/doc/web2c.texi index 1136b8e43d8..e6b0eeec290 100644 --- a/Build/source/texk/web2c/doc/web2c.texi +++ b/Build/source/texk/web2c/doc/web2c.texi @@ -12,7 +12,7 @@ The latest version is available from ftp://ftp.tug.org/tex/texinfo.tex.} @end tex @set version 7.5.7 -@set month-year July 2008 +@set month-year February 2009 @c Define new indices for commands in auxiliary files, filenames, and options. @defcodeindex cm @@ -907,6 +907,7 @@ otherwise, are available. * Initial TeX:: Making format files. * Formats:: Major TeX macro packages. * Languages and hyphenation:: TeX supports many human languages. +* Shell escapes:: DVI output to a socket. * IPC and TeX:: DVI output to a socket. * TeX extensions:: Changes to the TeX language. @end menu @@ -1078,29 +1079,11 @@ config file value @samp{output_comment}. @opindex -shell-escape @itemx -no-shell-escape @opindex -no-shell-escape -@cindex shell commands in @TeX{} -@cindex Bourne shell commands in @TeX{} -@vindex shell_escape @r{enabling in @TeX{}} -@findex \immediate\write18 -@findex \write18 @r{shell escape extension} -@findex system @r{C library function} -@cindex security, and shell escapes -Enable (or disable) the @samp{\write18@{@var{shell-command}@}} -feature. This is also enabled if the environment variable or config -file value @samp{shell_escape} is set to @samp{t} (but the -@samp{-no-shell-escape} command line option overrides this). (For -backwards compatibility, @samp{y} and @samp{1} are accepted as -synonyms of @samp{t}). It is disabled by default to avoid security -problems. When enabled, the @var{shell-command} string (which first -undergoes the usual @TeX{} expansions, just as in @samp{\special}) is -passed to the command shell (via the C library function -@samp{system}). The output of @var{shell-command} is not diverted -anywhere, so it will not appear in the log file. The system call -either happens at @samp{\output} time or right away, according to the -absence or presence of the @samp{\immediate} prefix, as usual for -@code{\write}. (If you as a @TeX{} administrator wish to implement -more stringent rules on what can be executed, you will need to modify -@file{tex.ch}.) +@itemx -shell-restricted +@opindex -shell-restricted +Enable, or disable, or enable with restrictions the +@samp{\write18@{@var{shell-command}@}} feature for external executing +shell commands. @xref{Shell escapes}. @item -src-specials @itemx -src-specials=@var{string} @@ -1612,13 +1595,119 @@ The only options are @samp{-help} and @samp{-version} (@pxref{Common options}). +@node Shell escapes +@section Shell escapes + +@cindex shell commands in @TeX{} +@cindex security, and shell escapes +@cindex restricted shell escapes +@cindex system command +@vindex shell_escape @r{enabling in @TeX{}} +@findex \immediate\write18 +@findex \write18 @r{shell escape extension} +@findex system @r{C library function} + +@TeX{} can execute @dfn{shell escapes}, that is, arbitrary shell +commands. Although tremendously useful, this also has obvious +security implications. Therefore, as of @TeX{} Live 2009, a +@dfn{restricted} mode for shell escapes is the default mode of +operation, which allows executing only certain commands, as specified +in the @file{texmf.cnf} configuration file. + +@itemize @bullet +@item +Unrestricted shell escapes are allowed if the option +@option{--shell-escape} is specified, or if the environment variable +or config file value @code{shell_escape} is set to @samp{t} or +@samp{y} and @samp{1}. + +@item +Restricted shell escapes are allowed if @code{shell_escape} is set to +@samp{p}. This is the default. + +@item +Shell escapes are completely disabled if @option{--no-shell-escape} is +specified, or if @code{shell_escape} is set to anything else. +@end itemize + +When enabled, the @TeX{} construct to execute a system command is +@code{\write18@{@var{shell-command}@}}; for example: + +@example +\write18@{echo "hello, world"@} +@end example + +@findex \output @r{routine, and @code{\write}} +From @TeX{}'s point of view, this is a normal @code{\write} command, +and is therefore subject to the usual @TeX{} expansions. Also, the +system call either happens during the @samp{\output} routine or right +away, according to the absence or presence of the @code{\immediate} +prefix, as usual for @code{\write}. + +@cindex exit status, of shell escape +The @var{shell-command} string is passed to the command shell (via the +C library function @code{system}). The output of @var{shell-command} +is not diverted anywhere, so it will not appear in the log file, or +anywhere but the terminal output. The exit status of the system call +is also not available to @TeX{}. + +In unrestricted mode, the argument is simply passed straight to +@code{system} unaltered. + +In restricted mode, ASCII double quote characters (@verb{|"|}) should +always be used in the argument to @code{\write18} where quoting of +arguments is needed, as in the example above. This is to achieve some +measure of system independence. On Unix systems, these are replaced +with single quote (@verb{|'|}) characters to avoid insecure further +expansion. Care is also taken on Windows to avoid additional +expansions (from, e.g., @verb{|`...`|}). Mismatched quotation marks +in the command string result in a diagnostic message in the log file; +no execution is performed. + +@findex shell_escape_commands +After quotation processing, if the first word (delimited by a space or +tab) of the command is in the list specified by the +@code{shell_escape_commands} configuration value, the command is +executed. Otherwise it is not. In any case, a message is written to +the log file. + +The @code{shell_escape_commands} value is a comma-separated list of +words. Whitespace is significant, and typically should not be +present. The default definition looks like this, but with more +commands included: + +@example +shell_escape_commands = bibtex,dvips,epstopdf,...,tex +@end example + +@cindex pipes, reading and writing +@findex \openin@r{, and pipes} +@findex \input@r{, and pipes} +@findex \openout@r{, and pipes} +@findex \pdfshellescape +pdf@TeX{} and lua@TeX{} support reading (via @code{\input} and +@code{\openin}) and writing (via @code{\openout}) from pipes if the +first character is @samp{|}. The following command is then treated +exactly the same as the argument to @code{\write18}. In these +engines, the primitive variable @code{\pdfshellescape} is set to 0 if +shell escapes are disabled, 1 if they are enabled, and 2 if they are +enabled with restrictions. + +@cindex web environments, and security +The purpose of this feature is to make it possible for @TeX{} +documents to perform useful external actions in the common case of an +individual user running a known document on his or her own machine. +In such environments as CGI scripts or wikis where the input has to be +considered untrustworthy, shell escapes should be completely disabled. + + @node IPC and TeX @section IPC and @TeX{} @cindex IPC @cindex sockets -(Sorry, but I'm not going to write this unless someone actually uses -this feature. Let me know.) +(If anyone uses this feature and needs documentation, write +@email{tex-k@@tug.org}.) This functionality is available only if the @samp{--enable-ipc} option was specified to @code{configure} during installation of Web2c @@ -1638,47 +1727,40 @@ debugging. @cindex @TeX{}, extensions to The base @TeX{} program has been extended in many ways. Here's a -partial list. Please send information on extensions not listed here to -the address in @ref{Reporting bugs,,, kpathsea, Kpathsea}. +partial list. @table @asis @item e-@TeX{} @cindex e-@TeX{} @cindex primitives, new -Adds many new primitives, including right-to-left typesetting. -Available from @url{http://www.vms.rhbnc.ac.uk/e-TeX/} and -@file{@var{CTAN:}/systems/e-tex}. +Adds many new primitives, including right-to-left typesetting and more +registers. Now frozen. @item Omega +@itemx Aleph @cindex Omega @cindex Unicode -Adds Unicode support, right-to-left typesetting, and more. Available -from @url{http://www.ens.fr/omega} and @file{@var{CTAN:}/systems/omega}. +These add Unicode support, right-to-left typesetting, and more. Omega +was the original program. Aleph is an updated version with a variety +of bug fixes, and includes e-@TeX{}. Neither is actively maintained. @item pdf@TeX{} @cindex pdf@TeX{} @cindex PDF -A variant of @TeX{} that produces PDF instead of DVI files. It also -includes primitives for hypertext and micro-typography. Available from -@file{@var{CTAN:}/systems/pdftex}. - -@item @samp{TeX--XeT} -@pindex TeX--XeT -@cindex Arabic typesetting -@cindex right-to-left typesetting -Adds primitives and DVI opcodes for right-to-left typesetting (as used -in Arabic, for example). An old version for @TeX{} 3.1415 is available -from @file{@var{CTAN:}/systems/knuth/tex--xet}. A newer version is -included in e-@TeX{}. - -@item File-handling @TeX{} -@cindex File-handling @TeX{} -@cindex DVI files, creating multiple -@cindex multiple DVI files, creating -Adds primitives for creating multiple DVI files in a single run; and -appending to output files as well as overwriting. Web2c implementation -available in the distribution file -@file{web2c/contrib/file-handling-tex}. +@cindex micro-typography +@cindex hypertext +Can produce PDF as well as DVI files. It also incorporates the +e-@TeX{} extensions, new primitives for hypertext and +micro-typography, reading/writing from pipes, and much more. Home +page: @url{http://pdftex.org}. + +@item lua@TeX{} +@cindex lua@TeX{} +@cindex Lua +Based on pdf@TeX{}, this also embeds the Lua programming language +(@url{http://lua.org}) and opens up the @TeX{} typesetting engine to +control from Lua. Home page: @url{http://luatex.org}. + @end table |