summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/kpathsea/ChangeLog15
-rw-r--r--Build/source/texk/kpathsea/kpathsea.info259
-rw-r--r--Build/source/texk/kpathsea/kpathsea.texi130
-rw-r--r--Build/source/texk/kpathsea/kpsewhich.c4
-rw-r--r--Build/source/texk/kpathsea/tex-file.c174
-rw-r--r--Build/source/texk/kpathsea/texmf.in47
-rwxr-xr-xMaster/bin/i386-linux/kpsewhichbin200425 -> 204455 bytes
-rw-r--r--Master/texmf/web2c/texmf.cnf51
8 files changed, 416 insertions, 264 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index 5c7261320e2..0d710629cc8 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,3 +1,18 @@
+2008-04-30 Karl Berry <karl@tug.org>
+
+ * kpsewhich.c (read_command_line): leave two spaces before alt
+ suffixes, just so they can be distinguished.
+
+ * tex-file.c (ALT_TEX_SUFFIXES): define this (rather belatedly)
+ to check for .sty, .cls, etc.
+ Rename other *_SUFFIXES to ALT_*_SUFFIXES.
+
+ * kpathsea.texi (File lookup): Document this.
+ * tex-file.c: (target_fontmaps, target_asis_name,
+ target_suffixed_names): new fns.
+ (kpse_find_file_generic): call them, respecting new cnf value
+ try_std_extension_first.
+
2008-04-29 Karl Berry <karl@tug.org>
* Makefile.in (install-data): do not cd $(srcdir) in any rule,
diff --git a/Build/source/texk/kpathsea/kpathsea.info b/Build/source/texk/kpathsea/kpathsea.info
index 7fdce091cab..e1184e7ebe1 100644
--- a/Build/source/texk/kpathsea/kpathsea.info
+++ b/Build/source/texk/kpathsea/kpathsea.info
@@ -1,18 +1,7 @@
-INFO-DIR-SECTION TeX
-START-INFO-DIR-ENTRY
-This is kpathsea.info, produced by makeinfo version 4.11 from kpathsea.texi.
+This is kpathsea.info, produced by makeinfo version 4.12 from
+kpathsea.texi.
-* Kpathsea: (kpathsea). File lookup along search paths.
-* kpsewhich: (kpathsea)Invoking kpsewhich. TeX file searching.
-* mktexfmt: (kpathsea)mktex scripts. Format (fmt/base/mem) generation.
-* mktexlsr: (kpathsea)Filename database. Update ls-R.
-* mktexmf: (kpathsea)mktex scripts. MF source generation.
-* mktexpk: (kpathsea)mktex scripts. PK bitmap generation.
-* mktextex: (kpathsea)mktex scripts. TeX source generation.
-* mktextfm: (kpathsea)mktex scripts. TeX font metric generation.
-END-INFO-DIR-ENTRY
-
- This file documents the Kpathsea library for path searching.
+This file documents the Kpathsea library for path searching.
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2007, 2008 Karl Berry & Olaf Weber.
@@ -31,6 +20,18 @@ manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Free Software Foundation.
+INFO-DIR-SECTION TeX
+START-INFO-DIR-ENTRY
+* Kpathsea: (kpathsea). File lookup along search paths.
+* kpsewhich: (kpathsea)Invoking kpsewhich. TeX file searching.
+* mktexfmt: (kpathsea)mktex scripts. Format (fmt/base/mem) generation.
+* mktexlsr: (kpathsea)Filename database. Update ls-R.
+* mktexmf: (kpathsea)mktex scripts. MF source generation.
+* mktexpk: (kpathsea)mktex scripts. PK bitmap generation.
+* mktextex: (kpathsea)mktex scripts. TeX source generation.
+* mktextfm: (kpathsea)mktex scripts. TeX font metric generation.
+END-INFO-DIR-ENTRY
+

File: kpathsea.info, Node: Top, Next: Introduction, Up: (dir)
@@ -39,7 +40,7 @@ Kpathsea library
This manual documents how to install and use the Kpathsea library for
filename lookup. It corresponds to version 3.5.6dev, released in
-March 2008.
+May 2008.
* Menu:
@@ -60,7 +61,7 @@ File: kpathsea.info, Node: Introduction, Next: Installation, Prev: Top, Up:
**************
This manual corresponds to version 3.5.6dev of the Kpathsea library,
-released in March 2008.
+released in May 2008.
The library's fundamental purpose is to return a filename from a
list of directories specified by the user, similar to what shells do
@@ -2074,10 +2075,10 @@ same directory, the directory in which a file is found is floated to the
top of the directory list.)
The "file must exist" condition comes into play with VF files and
-input files read by the TeX `\openin' command. These files may not
-exist (consider `cmr10.vf'), and so it would be wrong to search the
-disk for them. Therefore, if you fail to update `ls-R' when you
-install a new VF file, it will never be found.
+input files read by the TeX `\openin' command. These files might very
+well not exist (consider `cmr10.vf'), and so it would be wrong to
+search the disk for them. Therefore, if you fail to update `ls-R' when
+you install a new VF file, it will not be found.
Each path element is checked in turn: first the database, then the
disk. If a match is found, the search stops and the result is
@@ -2100,10 +2101,10 @@ absolute or explicitly relative, i.e., starts with `/' or `./' or
Ordinarily, if Kpathsea tries to access a file or directory that
cannot be read, it gives a warning. This is so you will be alerted to
-directories or files that accidentally lack read permission (for
-example, a `lost+found'). If you prefer not to see these warnings,
-include the value `readable' in the `TEX_HUSH' environment variable or
-config file value.
+directories or files that accidentally lack any read permission (for
+example, a `lost+found' directory). If you prefer not to see these
+warnings, include the value `readable' in the `TEX_HUSH' environment
+variable or config file value.
This generic path searching algorithm is implemented in
`kpathsea/pathsearch.c'. It is employed by a higher-level algorithm
@@ -2460,16 +2461,13 @@ File: kpathsea.info, Node: Filename database, Next: Invoking kpsewhich, Prev:
==============================
Kpathsea goes to some lengths to minimize disk accesses for searches
-(*note Subdirectory expansion::). Nevertheless, at installations with
-enough directories, searching each possible directory for a given file
-can take an excessively long time (depending on the speed of the disk,
-whether it's NFS-mounted, how patient you are, etc.).
+(*note Subdirectory expansion::). Nevertheless, in practice searching
+each possible directory in typical TeX installations takes an
+excessively long time.
- In practice, a font tree containing the standard PostScript and PCL
-fonts is large enough for searching to be noticeably slow on typical
-systems these days. Therefore, Kpathsea can use an externally-built
-"database" file named `ls-R' that maps files to directories, thus
-avoiding the need to exhaustively search the disk.
+ Therefore, Kpathsea can use an externally-built "filename database"
+file named `ls-R' that maps files to directories, thus avoiding the
+need to exhaustively search the disk.
A second database file `aliases' allows you to give additional names
to the files listed in `ls-R'. This can be helpful to adapt to "8.3"
@@ -3171,21 +3169,31 @@ searches are the exception, as described in the next section).
Here is the search strategy for a file NAME:
1. If the file format defines default suffixes, and the suffix of
NAME name is not already a known suffix for that format, try the
- name with each default appended, and use alternative names found
- in the fontmaps if necessary. We postpone searching the disk as
- long as possible. Example: given `foo.sty', look for `foo.sty.tex'
- before `foo.sty'. This is unfortunate, but allows us to find
- `foo.bar.tex' before `foo.bar' if both exist and we were given
- `foo.bar'.
+ name with each default appended, and use alternative names found in
+ the fontmaps if necessary. Example: given `foo.bar', look for
+ `foo.bar.tex'.
2. Search for NAME, and if necessary for alternative names found in
- the fontmaps. Again we avoid searching the disk if possible.
- Example: given `foo', we look for `foo'.
+ the fontmaps. Example: given `foo.bar', we also look for
+ `foo.bar'.
3. If the file format defines a program to invoke to create missing
files, run it (*note mktex scripts::).
- This is implemented in the routine `kpse_find_file' in
+ The order in which we search for "suffixed" name (item 1) or the
+"as-is" name (item 2) is controlled by the `try_std_extension_first'
+configuration value. The default set in `texmf.cnf' is true, since
+common suffixes are already recognized: `babel.sty' will only look for
+`babel.sty', not `babel.sty.tex', regardless of this setting.
+
+ When the suffix is unknown (e.g., `foo.bar'), both names are always
+tried; the difference is the order in which they are tried.
+
+ `try_std_extension_first' only affects names being looked up which
+*already* have an extension. A name without an extension (e.g., `tex
+story') will always have an extension added first.
+
+ This algorithm is implemented in the routine `kpse_find_file' in
`kpathsea/tex-file.c'. You can watch it in action with the debugging
options (*note Debugging::).
@@ -3997,6 +4005,7 @@ Index
* expansion, tilde: Tilde expansion. (line 6)
* expansion, variable: Variable expansion. (line 6)
* explicitly relative filenames: Searching overview. (line 52)
+* extensions, filename: File lookup. (line 23)
* externally-built filename database: Filename database. (line 6)
* extra colons: Default expansion. (line 6)
* extraclean Make target: Cleaning up. (line 23)
@@ -4144,7 +4153,7 @@ Index
* kpse_fallback_font: Fallback font. (line 15)
* kpse_find_*: Calling sequence. (line 60)
* kpse_find_file <1>: Calling sequence. (line 60)
-* kpse_find_file: File lookup. (line 26)
+* kpse_find_file: File lookup. (line 36)
* kpse_find_glyph_format: Glyph lookup. (line 26)
* kpse_format_info: Calling sequence. (line 45)
* kpse_format_info_type: Debugging. (line 61)
@@ -4474,6 +4483,7 @@ Index
* striptypeface: mktex configuration. (line 105)
* subdirectory searching: Subdirectory expansion.
(line 6)
+* suffixes, filename: File lookup. (line 23)
* suggestions, making: Introduction. (line 27)
* Sun 2: History. (line 12)
* Sun OpenWin patches: ShellWidgetClass. (line 29)
@@ -4519,7 +4529,7 @@ Index
* TeX support: TeX support. (line 6)
* TeX Users Group: Introduction. (line 39)
* tex-archive@math.utah.edu: Mailing lists. (line 25)
-* tex-file.c: File lookup. (line 26)
+* tex-file.c: File lookup. (line 36)
* tex-file.h: Programming overview.
(line 16)
* tex-glyph.c: Glyph lookup. (line 26)
@@ -4601,6 +4611,7 @@ Index
* trick for detecting leaf directories: Subdirectory expansion.
(line 22)
* trojan horse attack: Security. (line 10)
+* try_std_extension_first: File lookup. (line 23)
* TTFONTS: Supported file formats.
(line 181)
* tug.org: unixtex.ftp. (line 6)
@@ -4688,85 +4699,85 @@ Index

Tag Table:
-Node: Top1555
-Node: Introduction2202
-Node: History4182
-Node: Installation8274
-Node: Simple installation9064
-Node: Custom installation12647
-Node: Disk space13821
-Node: Kpathsea application distributions14705
-Node: Changing search paths15820
-Node: Default path features17002
-Node: Default path generation19138
-Node: Running configure20581
-Node: configure shells21632
-Node: configure options22684
-Node: configure environment24191
-Node: configure scenarios25993
-Node: Shared library27579
-Node: Running make28593
-Node: Installing files30640
-Node: Cleaning up32587
-Node: Filename database generation33635
-Node: mktex scripts34202
-Node: mktex configuration35479
-Node: mktex script names41298
-Node: mktex script arguments42689
-Node: Installation testing43579
-Node: Security43943
-Node: TeX directory structure46510
-Node: unixtex.ftp50932
-Node: Electronic distribution52947
-Node: CD-ROM distribution55712
-Node: Other TeX packages56682
-Node: Reporting bugs57978
-Node: Bug checklist58718
-Node: Mailing lists62420
-Node: Debugging63779
-Node: Logging68851
-Node: Common problems70721
-Node: Unable to find files71552
-Node: Slow path searching73963
-Node: Unable to generate fonts75340
-Node: TeX or Metafont failing77849
-Node: Empty Makefiles79727
-Node: XtStrings80957
-Node: dlopen81793
-Node: ShellWidgetClass82611
-Node: Pointer combination warnings84243
-Node: Path searching84632
-Node: Searching overview85279
-Node: Path sources88651
-Node: Config files89722
-Node: Path expansion93367
-Node: Default expansion94316
-Node: Variable expansion96386
-Node: Tilde expansion97789
-Node: Brace expansion98769
-Node: KPSE_DOT expansion99874
-Node: Subdirectory expansion100387
-Node: Filename database102736
-Node: ls-R104050
-Node: Filename aliases106944
-Node: Database format108122
-Node: Invoking kpsewhich109135
-Node: Path searching options110012
-Node: Auxiliary tasks116661
-Node: Standard options118482
-Node: TeX support118802
-Node: Supported file formats120093
-Node: File lookup127241
-Node: Glyph lookup128532
-Node: Basic glyph lookup129659
-Node: Fontmap130538
-Node: Fallback font133155
-Node: Suppressing warnings134120
-Node: Programming135225
-Node: Programming overview135738
-Node: Calling sequence138014
-Node: Program-specific files143043
-Node: Programming with config files144081
-Node: Index145381
+Node: Top1552
+Node: Introduction2197
+Node: History4175
+Node: Installation8267
+Node: Simple installation9057
+Node: Custom installation12640
+Node: Disk space13814
+Node: Kpathsea application distributions14698
+Node: Changing search paths15813
+Node: Default path features16995
+Node: Default path generation19131
+Node: Running configure20574
+Node: configure shells21625
+Node: configure options22677
+Node: configure environment24184
+Node: configure scenarios25986
+Node: Shared library27572
+Node: Running make28586
+Node: Installing files30633
+Node: Cleaning up32580
+Node: Filename database generation33628
+Node: mktex scripts34195
+Node: mktex configuration35472
+Node: mktex script names41291
+Node: mktex script arguments42682
+Node: Installation testing43572
+Node: Security43936
+Node: TeX directory structure46503
+Node: unixtex.ftp50925
+Node: Electronic distribution52940
+Node: CD-ROM distribution55705
+Node: Other TeX packages56675
+Node: Reporting bugs57971
+Node: Bug checklist58711
+Node: Mailing lists62413
+Node: Debugging63772
+Node: Logging68844
+Node: Common problems70714
+Node: Unable to find files71545
+Node: Slow path searching73956
+Node: Unable to generate fonts75333
+Node: TeX or Metafont failing77842
+Node: Empty Makefiles79720
+Node: XtStrings80950
+Node: dlopen81786
+Node: ShellWidgetClass82604
+Node: Pointer combination warnings84236
+Node: Path searching84625
+Node: Searching overview85272
+Node: Path sources88668
+Node: Config files89739
+Node: Path expansion93384
+Node: Default expansion94333
+Node: Variable expansion96403
+Node: Tilde expansion97806
+Node: Brace expansion98786
+Node: KPSE_DOT expansion99891
+Node: Subdirectory expansion100404
+Node: Filename database102753
+Node: ls-R103807
+Node: Filename aliases106701
+Node: Database format107879
+Node: Invoking kpsewhich108892
+Node: Path searching options109769
+Node: Auxiliary tasks116418
+Node: Standard options118239
+Node: TeX support118559
+Node: Supported file formats119850
+Node: File lookup126998
+Node: Glyph lookup128725
+Node: Basic glyph lookup129852
+Node: Fontmap130731
+Node: Fallback font133348
+Node: Suppressing warnings134313
+Node: Programming135418
+Node: Programming overview135931
+Node: Calling sequence138207
+Node: Program-specific files143236
+Node: Programming with config files144274
+Node: Index145574

End Tag Table
diff --git a/Build/source/texk/kpathsea/kpathsea.texi b/Build/source/texk/kpathsea/kpathsea.texi
index 4d0e823975e..3c4b785f1ac 100644
--- a/Build/source/texk/kpathsea/kpathsea.texi
+++ b/Build/source/texk/kpathsea/kpathsea.texi
@@ -3,34 +3,7 @@
@settitle Kpathsea: A library for path searching
@set version 3.5.6dev
-@set month-year March 2008
-
-@c Define new indices for commands, filenames, and options.
-@defcodeindex cm
-@defcodeindex fl
-@defcodeindex op
-
-@c Put everything in one index (arbitrarily chosen to be the concept index).
-@syncodeindex cm cp
-@syncodeindex fl cp
-@syncodeindex fn cp
-@syncodeindex ky cp
-@syncodeindex op cp
-@syncodeindex pg cp
-@syncodeindex tp cp
-@syncodeindex vr cp
-
-@dircategory TeX
-@direntry
-* Kpathsea: (kpathsea). File lookup along search paths.
-* kpsewhich: (kpathsea)Invoking kpsewhich. TeX file searching.
-* mktexfmt: (kpathsea)mktex scripts. Format (fmt/base/mem) generation.
-* mktexlsr: (kpathsea)Filename database. Update ls-R.
-* mktexmf: (kpathsea)mktex scripts. MF source generation.
-* mktexpk: (kpathsea)mktex scripts. PK bitmap generation.
-* mktextex: (kpathsea)mktex scripts. TeX source generation.
-* mktextfm: (kpathsea)mktex scripts. TeX font metric generation.
-@end direntry
+@set month-year May 2008
@copying
This file documents the Kpathsea library for path searching.
@@ -60,9 +33,35 @@ except that this permission notice may be stated in a translation
approved by the Free Software Foundation.
@end copying
+@c Define new indices for commands, filenames, and options.
+@defcodeindex cm
+@defcodeindex fl
+@defcodeindex op
-@titlepage
+@c Put everything in one index (arbitrarily chosen to be the concept index).
+@syncodeindex cm cp
+@syncodeindex fl cp
+@syncodeindex fn cp
+@syncodeindex ky cp
+@syncodeindex op cp
+@syncodeindex pg cp
+@syncodeindex tp cp
+@syncodeindex vr cp
+@dircategory TeX
+@direntry
+* Kpathsea: (kpathsea). File lookup along search paths.
+* kpsewhich: (kpathsea)Invoking kpsewhich. TeX file searching.
+* mktexfmt: (kpathsea)mktex scripts. Format (fmt/base/mem) generation.
+* mktexlsr: (kpathsea)Filename database. Update ls-R.
+* mktexmf: (kpathsea)mktex scripts. MF source generation.
+* mktexpk: (kpathsea)mktex scripts. PK bitmap generation.
+* mktextex: (kpathsea)mktex scripts. TeX source generation.
+* mktextfm: (kpathsea)mktex scripts. TeX font metric generation.
+@end direntry
+
+
+@titlepage
@title Kpathsea library
@subtitle for version @value{version}
@subtitle @value{month-year}
@@ -75,6 +74,9 @@ approved by the Free Software Foundation.
@end titlepage
+@contents
+
+
@ifnottex
@node Top
@top Kpathsea library
@@ -330,10 +332,11 @@ top of the directory list.)
@flindex cmr10.vf
@findex \openin
The ``file must exist'' condition comes into play with VF files and
-input files read by the @TeX{} @samp{\openin} command. These files may
-not exist (consider @file{cmr10.vf}), and so it would be wrong to search
-the disk for them. Therefore, if you fail to update @file{ls-R} when
-you install a new VF file, it will never be found.
+input files read by the @TeX{} @samp{\openin} command. These files
+might very well not exist (consider @file{cmr10.vf}), and so it would
+be wrong to search the disk for them. Therefore, if you fail to
+update @file{ls-R} when you install a new VF file, it will not be
+found.
Each path element is checked in turn: first the database, then the disk.
If a match is found, the search stops and the result is returned. This
@@ -365,12 +368,12 @@ or @samp{../}, Kpathsea simply checks if that file exists.
@cindex warnings, file access
@flindex lost+found @r{directory}
@vindex TEX_HUSH
-Ordinarily, if Kpathsea tries to access a file or directory that cannot
-be read, it gives a warning. This is so you will be alerted to
-directories or files that accidentally lack read permission (for
-example, a @file{lost+found}). If you prefer not to see these warnings,
-include the value @samp{readable} in the @code{TEX_HUSH} environment
-variable or config file value.
+Ordinarily, if Kpathsea tries to access a file or directory that
+cannot be read, it gives a warning. This is so you will be alerted to
+directories or files that accidentally lack any read permission (for
+example, a @file{lost+found} directory). If you prefer not to see
+these warnings, include the value @samp{readable} in the
+@code{TEX_HUSH} environment variable or config file value.
This generic path searching algorithm is implemented in
@file{kpathsea/pathsearch.c}. It is employed by a higher-level
@@ -838,15 +841,12 @@ Subdirectory expansion is implemented in the source file
@cindex externally-built filename database
Kpathsea goes to some lengths to minimize disk accesses for searches
-(@pxref{Subdirectory expansion}). Nevertheless, at installations with
-enough directories, searching each possible directory for a given file
-can take an excessively long time (depending on the speed of the disk,
-whether it's NFS-mounted, how patient you are, etc.).
-
-In practice, a font tree containing the standard PostScript and PCL
-fonts is large enough for searching to be noticeably slow on typical
-systems these days. Therefore, Kpathsea can use an externally-built
-``database'' file named @file{ls-R} that maps files to directories, thus
+(@pxref{Subdirectory expansion}). Nevertheless, in practice searching
+each possible directory in typical @TeX{} installations takes an
+excessively long time.
+
+Therefore, Kpathsea can use an externally-built @dfn{filename
+database} file named @file{ls-R} that maps files to directories, thus
avoiding the need to exhaustively search the disk.
A second database file @file{aliases} allows you to give additional
@@ -1843,26 +1843,40 @@ Here is the search strategy for a file @var{name}:
@item
If the file format defines default suffixes, and the suffix of
@var{name} name is not already a known suffix for that format, try the
-name with each default appended, and use alternative names found in the
-fontmaps if necessary. We postpone searching the disk as long as
-possible. Example: given @samp{foo.sty}, look for @samp{foo.sty.tex}
-before @samp{foo.sty}. This is unfortunate, but allows us to find
-@samp{foo.bar.tex} before @samp{foo.bar} if both exist and we were given
-@samp{foo.bar}.
+name with each default appended, and use alternative names found in
+the fontmaps if necessary. Example: given @samp{foo.bar}, look for
+@samp{foo.bar.tex}.
@item
Search for @var{name}, and if necessary for alternative names found in
-the fontmaps. Again we avoid searching the disk if possible. Example:
-given @samp{foo}, we look for @samp{foo}.
+the fontmaps. Example: given @samp{foo.bar}, we also look for
+@samp{foo.bar}.
@item
If the file format defines a program to invoke to create missing files,
run it (@pxref{mktex scripts}).
@end enumerate
+@cindex extensions, filename
+@cindex suffixes, filename
+@vindex try_std_extension_first
+The order in which we search for ``suffixed'' name (item@tie{}1) or
+the ``as-is'' name (item@tie{}2) is controlled by the
+@file{try_std_extension_first} configuration value. The default set
+in @file{texmf.cnf} is true, since common suffixes are already
+recognized: @samp{babel.sty} will only look for @samp{babel.sty}, not
+@samp{babel.sty.tex}, regardless of this setting.
+
+When the suffix is unknown (e.g., @samp{foo.bar}), both names are
+always tried; the difference is the order in which they are tried.
+
+@file{try_std_extension_first} only affects names being looked up
+which *already* have an extension. A name without an extension (e.g.,
+@samp{tex story}) will always have an extension added first.
+
@flindex tex-file.c
@findex kpse_find_file
-This is implemented in the routine @code{kpse_find_file} in
+This algorithm is implemented in the routine @code{kpse_find_file} in
@file{kpathsea/tex-file.c}. You can watch it in action with the
debugging options (@pxref{Debugging}).
@@ -2367,6 +2381,4 @@ No initialization calls are needed.
@printindex cp
-@contents
-
@bye
diff --git a/Build/source/texk/kpathsea/kpsewhich.c b/Build/source/texk/kpathsea/kpsewhich.c
index ce48aac14d0..8965dfcd972 100644
--- a/Build/source/texk/kpathsea/kpsewhich.c
+++ b/Build/source/texk/kpathsea/kpsewhich.c
@@ -404,6 +404,10 @@ read_command_line P2C(int, argc, string *, argv)
putchar (' ');
fputs (*ext, stdout);
}
+ if (kpse_format_info[f].alt_suffix) {
+ /* leave extra space between default and alt suffixes */
+ putchar (' ');
+ }
for (ext = kpse_format_info[f].alt_suffix; ext && *ext; ext++) {
putchar (' ');
fputs (*ext, stdout);
diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c
index af1b297b9fe..b566df0877e 100644
--- a/Build/source/texk/kpathsea/tex-file.c
+++ b/Build/source/texk/kpathsea/tex-file.c
@@ -543,23 +543,25 @@ kpse_init_format P1C(kpse_file_format_type, format)
break;
case kpse_pict_format:
INIT_FORMAT ("graphic/figure", DEFAULT_TEXINPUTS, PICT_ENVS);
-#define PICT_SUFFIXES ".eps", ".epsi"
- ALT_SUFFIXES (PICT_SUFFIXES);
+#define ALT_PICT_SUFFIXES ".eps", ".epsi"
+ ALT_SUFFIXES (ALT_PICT_SUFFIXES);
FMT_INFO.binmode = true;
break;
case kpse_tex_format:
init_maketex (format, "mktextex", NULL);
INIT_FORMAT ("tex", DEFAULT_TEXINPUTS, TEX_ENVS);
SUFFIXES (".tex");
- /* We don't maintain a list of alternate TeX suffixes. Such a list
- could never be complete. */
+ /* TeX files can have any obscure suffix in the world (or none at
+ all). Only check for the most common ones. */
+#define ALT_TEX_SUFFIXES ".sty", ".cls", ".fd", ".aux", ".bbl", ".def", ".clo", ".ldf"
+ ALT_SUFFIXES (ALT_TEX_SUFFIXES);
break;
case kpse_tex_ps_header_format:
INIT_FORMAT ("PostScript header", DEFAULT_TEXPSHEADERS,
TEX_PS_HEADER_ENVS);
-/* Unfortunately, dvipsk uses this format for type1 fonts. */
-#define TEXPSHEADER_SUFFIXES ".pro"
- ALT_SUFFIXES (TEXPSHEADER_SUFFIXES);
+/* Unfortunately, at one time dvips used this format for type1 fonts. */
+#define ALT_TEXPSHEADER_SUFFIXES ".pro"
+ ALT_SUFFIXES (ALT_TEXPSHEADER_SUFFIXES);
FMT_INFO.binmode = true;
break;
case kpse_texdoc_format:
@@ -731,6 +733,79 @@ kpse_init_format P1C(kpse_file_format_type, format)
return FMT_INFO.path;
}
+/* These are subroutines called twice when finding file, to construct
+ the list of names to search for. */
+
+/* We don't even use fontmaps any more in practice, they were for things
+ like the lcircle10/lcirc10 name change many years ago, but let's keep
+ the support working nonetheless. */
+
+static void
+target_fontmaps (const_string **target, unsigned *count, const_string name)
+{
+ string *mapped_names = kpse_fontmap_lookup (name);
+
+ if (mapped_names != NULL) {
+ string mapped_name;
+ /* We leak mapped_names and its elements, some of the time. */
+ while ((mapped_name = *mapped_names++) != NULL) {
+ (*target)[(*count)] = xstrdup (mapped_name);
+ (*count)++;
+ XRETALLOC ((*target), (*count)+1, const_string);
+ }
+ }
+}
+
+
+/* Possibly add NAME (and any fontmap equivalents) to the string list
+ in TARGET, depending on the various other parameters. */
+
+static void
+target_asis_name (const_string **target, unsigned *count,
+ kpse_file_format_type format,
+ const_string name, boolean use_fontmaps, boolean has_potential_suffix,
+ string has_any_suffix)
+{
+ /* Look for the name we've been given, provided non-suffix
+ searches are allowed or the name already includes a suffix. */
+ if (has_potential_suffix || !FMT_INFO.suffix_search_only) {
+ (*target)[(*count)] = xstrdup (name);
+ (*count)++;
+ XRETALLOC ((*target), (*count)+1, const_string);
+
+ if (use_fontmaps) {
+ target_fontmaps (target, count, name);
+ }
+ }
+}
+
+
+/* Possibly add NAME (and any fontmap equivalents), with any suffixes
+ for this FORMAT appended, to TARGET -- if it doesn't already have one
+ of the potential suffixes for FORMAT. */
+
+static void
+target_suffixed_names (const_string **target, unsigned *count,
+ kpse_file_format_type format,
+ const_string name, boolean use_fontmaps, boolean has_potential_suffix)
+{
+ const_string *ext;
+ if (has_potential_suffix || !FMT_INFO.suffix) {
+ return;
+ }
+
+ for (ext = FMT_INFO.suffix; *ext; ext++) {
+ string name_with_suffix = concat (name, *ext);
+ (*target)[(*count)] = name_with_suffix;
+ (*count)++;
+ XRETALLOC ((*target), (*count)+1, const_string);
+
+ if (use_fontmaps) {
+ target_fontmaps (target, count, name_with_suffix);
+ }
+ }
+}
+
/* Look up a file NAME of type FORMAT, and the given MUST_EXIST. This
initializes the path spec for FORMAT if it's the first lookup of that
type. Return the filename found, or NULL. This is the most likely
@@ -753,13 +828,13 @@ string *
kpse_find_file_generic P4C(const_string, name, kpse_file_format_type, format,
boolean, must_exist, boolean, all)
{
- const_string *ext;
- string mapped_name;
- string *mapped_names;
const_string *target;
+ const_string *ext;
unsigned count;
unsigned name_len = 0;
- boolean name_has_suffix_already = false;
+ boolean has_potential_suffix = false;
+ string has_any_suffix = NULL;
+ string try_std_extension_first = NULL;
boolean use_fontmaps = (format == kpse_tfm_format
|| format == kpse_gf_format
|| format == kpse_pk_format
@@ -779,62 +854,59 @@ kpse_find_file_generic P4C(const_string, name, kpse_file_format_type, format,
/* Do variable and tilde expansion. */
name = kpse_expand (name);
-
+
+ try_std_extension_first = kpse_var_value ("try_std_extension_first");
+ has_any_suffix = strrchr (name, '.');
+ if (has_any_suffix) {
+ string p = strchr (has_any_suffix, DIR_SEP);
+ if (p) {
+ has_any_suffix = NULL;
+ }
+ }
+
/* Does NAME already end in a possible suffix? */
name_len = strlen (name);
if (FMT_INFO.suffix) {
- for (ext = FMT_INFO.suffix; !name_has_suffix_already && *ext; ext++) {
+ for (ext = FMT_INFO.suffix; !has_potential_suffix && *ext; ext++) {
unsigned suffix_len = strlen (*ext);
- name_has_suffix_already = (name_len >= suffix_len
+ has_potential_suffix = (name_len >= suffix_len
&& FILESTRCASEEQ (*ext, name + name_len - suffix_len));
}
}
- if (!name_has_suffix_already && FMT_INFO.alt_suffix) {
- for (ext = FMT_INFO.alt_suffix; !name_has_suffix_already && *ext; ext++) {
+ if (!has_potential_suffix && FMT_INFO.alt_suffix) {
+ for (ext = FMT_INFO.alt_suffix; !has_potential_suffix && *ext; ext++) {
unsigned suffix_len = strlen (*ext);
- name_has_suffix_already = (name_len >= suffix_len
+ has_potential_suffix = (name_len >= suffix_len
&& FILESTRCASEEQ (*ext, name + name_len - suffix_len));
}
}
- /* Set up list of target names to search for. */
+ /* Set up list of target names to search for, the order depending on
+ try_std_extension_first. */
count = 0;
target = XTALLOC1 (const_string);
- /* Case #1: NAME doesn't have a suffix which is equal to a "standard"
- suffix. For example, foo.bar, but not foo.tex. We look for the
- name with the standard suffixes appended. */
- if (!name_has_suffix_already && FMT_INFO.suffix) {
- for (ext = FMT_INFO.suffix; *ext; ext++) {
- string name_with_suffix = concat (name, *ext);
- target[count++] = name_with_suffix;
- XRETALLOC (target, count+1, const_string);
- if (use_fontmaps
- && (mapped_names = kpse_fontmap_lookup (name_with_suffix)) != NULL)
- {
- /* FIXME: we leak mapped_names and its elements, some of the time */
- while ((mapped_name = *mapped_names++) != NULL) {
- target[count++] = xstrdup (mapped_name);
- XRETALLOC (target, count+1, const_string);
- }
- }
- }
- }
- /* Case #2: Just look for the name we've been given, provided non-suffix
- searches are allowed or the name already includes a suffix. */
- if (name_has_suffix_already || !FMT_INFO.suffix_search_only) {
- target[count++] = xstrdup (name);
- XRETALLOC (target, count+1, const_string);
- if (use_fontmaps && (mapped_names = kpse_fontmap_lookup (name)) != NULL) {
- /* FIXME: we leak mapped_names and its elements, some of the time */
- while ((mapped_name = *mapped_names++) != NULL) {
- target[count++] = xstrdup (mapped_name);
- XRETALLOC (target, count+1, const_string);
- }
- }
+
+ if (has_any_suffix
+ && (try_std_extension_first == NULL || *try_std_extension_first == 'f'
+ || *try_std_extension_first == '0')) {
+ target_asis_name (&target, &count, format, name, use_fontmaps,
+ has_potential_suffix, has_any_suffix);
+ target_suffixed_names (&target, &count, format, name, use_fontmaps,
+ has_potential_suffix);
+ } else {
+ target_suffixed_names (&target, &count, format, name, use_fontmaps,
+ has_potential_suffix);
+ target_asis_name (&target, &count, format, name, use_fontmaps,
+ has_potential_suffix, has_any_suffix );
}
+
/* Terminate list. */
target[count] = NULL;
+ if (try_std_extension_first) {
+ free (try_std_extension_first);
+ }
+
/* Search, trying to minimize disk-pounding. */
ret = kpse_path_search_list_generic (FMT_INFO.path, target, false, all);
/* Do we need to pound the disk? */
@@ -845,11 +917,11 @@ kpse_find_file_generic P4C(const_string, name, kpse_file_format_type, format,
/* We look for a subset of the previous set of names, so the
target array is large enough. In particular, we don't pound
the disk for alternate names from the fontmaps. */
- if (!name_has_suffix_already && FMT_INFO.suffix_search_only) {
+ if (!has_potential_suffix && FMT_INFO.suffix_search_only) {
for (ext = FMT_INFO.suffix; *ext; ext++)
target[count++] = concat (name, *ext);
}
- if (name_has_suffix_already || !FMT_INFO.suffix_search_only) {
+ if (has_potential_suffix || !FMT_INFO.suffix_search_only) {
target[count++] = xstrdup (name);
}
target[count] = NULL;
diff --git a/Build/source/texk/kpathsea/texmf.in b/Build/source/texk/kpathsea/texmf.in
index 04f813645d7..4045188ab47 100644
--- a/Build/source/texk/kpathsea/texmf.in
+++ b/Build/source/texk/kpathsea/texmf.in
@@ -447,7 +447,38 @@ progname = unsetprogname
engine = unsetengine
-% Part 2: Non-path options.
+% Part 2: Options.
+
+% If this is true, `tex a.b' will look first for a.b.tex (within each
+% path element), and then for a.b, i.e., we try standard extensions
+% first. If this is false, we first look for a.b and then a.b.tex,
+% i.e., we try the name as-is first.
+%
+% Both names are always tried; the difference is the order in which they
+% are tried. The setting applies to all searches, not just .tex.
+%
+% This setting only affects names being looked up which *already* have
+% an extension. A name without an extension (e.g., `tex story') will
+% always have an extension added first.
+%
+% The default is true, because we already avoid adding the standard
+% extension(s) in most common cases. E.g., babel.sty will only look for
+% babel.sty, not babel.sty.tex, regardless of this setting.
+%
+try_std_extension_first = t
+
+% Enable system commands via \write18{...}? Obviously insecure, despite
+% being so useful.
+shell_escape = f
+
+% Allow TeX \openin, \openout, or \input on filenames starting with `.'
+% (e.g., .rhosts) or outside the current tree (e.g., /etc/passwd)?
+% a (any) : any file can be opened.
+% r (restricted) : disallow opening "dotfiles".
+% p (paranoid) : as `r' and disallow going to parent directories, and
+% restrict absolute paths to be under $TEXMFOUTPUT.
+openout_any = p
+openin_any = a
% Write .log/.dvi/etc. files here, if the current directory is unwritable.
% TEXMFOUTPUT = /tmp
@@ -463,18 +494,6 @@ MISSFONT_LOG = missfont.log
% To suppress nothing, use TEX_HUSH = none or do not set the variable at all.
TEX_HUSH = none
-% Enable system commands via \write18{...}?
-shell_escape = f
-
-% Allow TeX \openin, \openout, or \input on filenames starting with `.'
-% (e.g., .rhosts) or outside the current tree (e.g., /etc/passwd)?
-% a (any) : any file can be opened.
-% r (restricted) : disallow opening "dotfiles".
-% p (paranoid) : as 'r' and disallow going to parent directories, and
-% restrict absolute paths to be under $TEXMFOUTPUT.
-openout_any = p
-openin_any = a
-
% Allow TeX, MF, and MP to parse the first line of an input file for
% the %&format construct.
parse_first_line = t
@@ -606,7 +625,7 @@ gf_buf_size = 16384 % MF
% 45 < error_line < 255;
% 30 < half_error_line < error_line - 15;
% 60 <= max_print_line;
-% These apply to Metafont and MetaPost as well.
+% These apply to TeX, Metafont, and MetaPost.
error_line = 79
half_error_line = 50
max_print_line = 79
diff --git a/Master/bin/i386-linux/kpsewhich b/Master/bin/i386-linux/kpsewhich
index 1b43783f1e4..443d015a6c3 100755
--- a/Master/bin/i386-linux/kpsewhich
+++ b/Master/bin/i386-linux/kpsewhich
Binary files differ
diff --git a/Master/texmf/web2c/texmf.cnf b/Master/texmf/web2c/texmf.cnf
index d5c16143d5d..950e8822a8f 100644
--- a/Master/texmf/web2c/texmf.cnf
+++ b/Master/texmf/web2c/texmf.cnf
@@ -402,7 +402,7 @@ OTPINPUTS = .;$TEXMF/omega/otp//
OCPINPUTS = .;$TEXMF/omega/ocp//
% Some additional input variables for several programs. If you add
-% a program that uses the 'other text files' or 'other binary files'
+% a program that uses the `other text files' or `other binary files'
% search formats, you'll want to add their variables here as well.
T4HTINPUTS = .;$TEXMF/tex4ht//
@@ -447,7 +447,38 @@ progname = unsetprogname
engine = unsetengine
-% Part 2: Non-path options.
+% Part 2: Options.
+
+% If this is true, `tex a.b' will look first for a.b.tex (within each
+% path element), and then for a.b, i.e., we try standard extensions
+% first. If this is false, we first look for a.b and then a.b.tex,
+% first. If this is false, we first look for a.b and then a.b.tex,
+% i.e., we try the name as-is first.
+%
+% Both names are always tried; the difference is the order in which they
+% are tried. The setting applies to all searches, not just .tex.
+%
+% This setting only affects names being looked up which *already* have
+% an extension. A name without an extension (e.g., `tex story') will
+% always have an extension added first.
+%
+% The default is true, because we already avoid adding the standard
+% extension(s) in most common cases. E.g., babel.sty will only look for
+% babel.sty, not babel.sty.tex, regardless of this setting.
+try_std_extension_first = t
+
+% Enable system commands via \write18{...}? Obviously insecure, despite
+% being so useful.
+shell_escape = f
+
+% Allow TeX \openin, \openout, or \input on filenames starting with `.'
+% (e.g., .rhosts) or outside the current tree (e.g., /etc/passwd)?
+% a (any) : any file can be opened.
+% r (restricted) : disallow opening "dotfiles".
+% p (paranoid) : as `r' and disallow going to parent directories, and
+% restrict absolute paths to be under $TEXMFOUTPUT.
+openout_any = p
+openin_any = a
% Write .log/.dvi/etc. files here, if the current directory is unwritable.
% TEXMFOUTPUT = /tmp
@@ -463,18 +494,6 @@ MISSFONT_LOG = missfont.log
% To suppress nothing, use TEX_HUSH = none or do not set the variable at all.
TEX_HUSH = none
-% Enable system commands via \write18{...}?
-shell_escape = f
-
-% Allow TeX \openin, \openout, or \input on filenames starting with `.'
-% (e.g., .rhosts) or outside the current tree (e.g., /etc/passwd)?
-% a (any) : any file can be opened.
-% r (restricted) : disallow opening "dotfiles".
-% p (paranoid) : as 'r' and disallow going to parent directories, and
-% restrict absolute paths to be under $TEXMFOUTPUT.
-openout_any = p
-openin_any = a
-
% Allow TeX, MF, and MP to parse the first line of an input file for
% the %&format construct.
parse_first_line = t
@@ -548,7 +567,7 @@ extra_mem_bot.context = 4000000
% Must be >= 20000 and <= 4000000 (without tex.ch changes).
font_mem_size = 3000000
-% Total number of fonts. Must be >= 50 and <= 2000 (without tex.ch changes).
+% Total number of fonts. Must be >= 50 and <= 5000 (without tex.ch changes).
font_max = 5000
% Extra space for the hash table of control sequences (which allows 10K
@@ -606,7 +625,7 @@ gf_buf_size = 16384 % MF
% 45 < error_line < 255;
% 30 < half_error_line < error_line - 15;
% 60 <= max_print_line;
-% These apply to Metafont and MetaPost as well.
+% These apply to TeX, Metafont, and MetaPost.
error_line = 79
half_error_line = 50
max_print_line = 79