summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-12-13 17:23:10 +0000
committerKarl Berry <karl@freefriends.org>2018-12-13 17:23:10 +0000
commit4d763ea3fc9e08f00534d39b6ba9dfc621bf6402 (patch)
tree9c93c3d6f8122be8235a9dce24564348125ed558 /Build
parentf29df809ce8fc8a1295118a60b33a476ab42399e (diff)
have kpsewhich --var-value expand braces too; also, recognize eithe ; or : regardless of the current system when parsing elements from a path (https://github.com/TeX-Live/texlive-source/issues/3)
git-svn-id: svn://tug.org/texlive/trunk@49400 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/ChangeLog17
-rw-r--r--Build/source/texk/kpathsea/NEWS7
-rw-r--r--Build/source/texk/kpathsea/c-pathch.h11
-rw-r--r--Build/source/texk/kpathsea/doc/kpathsea.info151
-rw-r--r--Build/source/texk/kpathsea/doc/kpathsea.texi31
-rw-r--r--Build/source/texk/kpathsea/kpsewhich.c10
-rw-r--r--Build/source/texk/kpathsea/path-elt.c16
-rw-r--r--Build/source/texk/kpathsea/pathsearch.h14
8 files changed, 147 insertions, 110 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog
index fd5d48a42bb..204430a00ac 100644
--- a/Build/source/texk/kpathsea/ChangeLog
+++ b/Build/source/texk/kpathsea/ChangeLog
@@ -1,5 +1,22 @@
2018-12-12 Karl Berry <karl@freefriends.org>
+ * c-pathch.h (IS_KPSE_SEP): new macro to check for either : or ;
+ regardless of the current system.
+ * path-elt.c (element): use it when extracting the path elements,
+ so that we'll get ~ expansion on Unix in, e.g.,
+ env FOO='/;~' ./kpsewhich --expand-braces='$FOO'
+ * kpsewhich.c (main): call kpathsea_brace_expand on the result
+ from kpathsea_var_value, so that we'll get ~ expansion in, e.g.,
+ env FOO='/:~' ./kpsewhich --var-value=FOO
+ Original report from e-kwsm (E Kawashima),
+ https://github.com/TeX-Live/texlive-source/issues/3
+
+ * NEWS,
+ * doc/kpathsea.texi (Auxiliary tasks): document that -var-value
+ now does brace expansion.
+
+2018-12-12 Karl Berry <karl@freefriends.org>
+
* expand.h,
* pathsearch.h,
* cnf.c: doc fixes.
diff --git a/Build/source/texk/kpathsea/NEWS b/Build/source/texk/kpathsea/NEWS
index 6fc42bfa3ef..e57f83ac467 100644
--- a/Build/source/texk/kpathsea/NEWS
+++ b/Build/source/texk/kpathsea/NEWS
@@ -1,6 +1,13 @@
$Id$
This file records noteworthy changes. (Public domain.)
+6.3.1 (for TeX Live 2019)
+* kpsewhich --var-value does brace expansion as well as variable and
+ tilde expansion.
+* The kpathsea_path_search() and related functions always recognize either
+ common path separator (: or ;) when splitting paths into elements.
+ (Before, there were some unusual contexts where this did not happen.)
+
6.3.0 (for TeX Live 2018, 14 April 2018)
* New configuration value texmf_casefold_search to fall back to
case-insensitive search in non-system directories if there is no exact
diff --git a/Build/source/texk/kpathsea/c-pathch.h b/Build/source/texk/kpathsea/c-pathch.h
index 76352f82a6d..6234b56c9b6 100644
--- a/Build/source/texk/kpathsea/c-pathch.h
+++ b/Build/source/texk/kpathsea/c-pathch.h
@@ -1,7 +1,7 @@
/* c-pathch.h: define the characters which separate components of
filenames and environment variable paths.
- Copyright 1992, 1993, 1995, 1997, 2008 Karl Berry.
+ Copyright 1992, 1993, 1995, 1997, 2008, 2018 Karl Berry.
Copyright 1997, 1999, 2001, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -97,4 +97,13 @@
#define IS_ENV_SEP(ch) ((ch) == ENV_SEP)
#endif
+/* Because paths in Kpathsea cnf files are system-independent, allowing
+ use of either ; or : regardless of the current system, sometimes we
+ need to check for either of the possible path separators. */
+#ifndef IS_KPSE_SEP
+#define IS_KPSE_SEP(ch) ((ch) == ':' || (ch) == ';')
+/* In principle we should do it differently on VMS and VMCMS,
+ but I'm guessing no one is compiling current kpathsea sources there. */
+#endif
+
#endif /* not C_PATHCH_H */
diff --git a/Build/source/texk/kpathsea/doc/kpathsea.info b/Build/source/texk/kpathsea/doc/kpathsea.info
index 547ea1a5161..ee5c11d3030 100644
--- a/Build/source/texk/kpathsea/doc/kpathsea.info
+++ b/Build/source/texk/kpathsea/doc/kpathsea.info
@@ -37,7 +37,7 @@ Kpathsea library
****************
This manual documents the Kpathsea library for path searching. It
-corresponds to version 6.3.0, released in July 2018.
+corresponds to version 6.3.0, released in December 2018.
* Menu:
@@ -62,7 +62,7 @@ File: kpathsea.info, Node: Introduction, Next: unixtex.ftp, Prev: Top, Up: T
**************
This manual corresponds to version 6.3.0 of the Kpathsea library,
-released in July 2018.
+released in December 2018.
The library's fundamental purpose is to return a filename from a list
of directories specified by the user, similar to what shells do when
@@ -725,7 +725,7 @@ File: kpathsea.info, Node: Brace expansion, Next: KPSE_DOT expansion, Prev: T
foo/{1,2}/baz
expands to 'foo/1/baz:foo/2/baz'. ':' is the path separator on the
-current system; e.g., on a DOS system, it's ';'.
+current system; e.g., on a Windows system, it's ';'.
Braces can be nested; for example, 'x{A,B{1,2}}y' expands to
'xAy:xB1y:xB2y'.
@@ -738,7 +738,7 @@ example, 'x{A,B}{1,2}y' expands to 'x{A,B}1y:x{A,B}2y', which expands to
assigning a brace list to '$TEXMF', as mentioned in 'texmf.in'.
You can also use the path separator instead of the comma. The last
-example could have been written 'x{A:B}{1:2}y'.
+example could have been written 'x{A:B}{1:2}y' (on Unix).
Brace expansion is implemented in the source file
'kpathsea/expand.c'.
@@ -1425,8 +1425,8 @@ Kpsewhich provides some features in addition to path lookup as such:
Set debugging options to NUM. *Note Debugging::.
'--expand-braces=STRING'
- Output variable and brace expansion of STRING. *Note Path
- expansion::.
+ Output variable, tilde, and brace expansion of STRING, which is
+ assumed to be a single path element. *Note Path expansion::.
'--expand-path=STRING'
Output the complete expansion of STRING, with each element
@@ -1444,12 +1444,12 @@ Kpsewhich provides some features in addition to path lookup as such:
=>
For one-shot uses of an arbitrary (not built in to Kpathsea) path,
- see '--path' (*note Path searching options::)
+ see '--path' (*note Path searching options::).
'--expand-var=STRING'
- Output the variable and tilde expansion of STRING the 'mktex...'
- scripts run 'kpsewhich --expand-var='$TEXMF'' to find the root of
- the TeX system hierarchy. *Note Path expansion::.
+ Output the variable and tilde expansion of STRING. For example,
+ with the usual 'texmf.cnf', 'kpsewhich --expand-var='$TEXMF''
+ returns the TeX system hierarchy root(s). *Note Path expansion::.
'--help-formats'
Output information about each supported format (*note Supported
@@ -1471,9 +1471,10 @@ Kpsewhich provides some features in addition to path lookup as such:
'--var-value=VARIABLE'
Outputs the value of VARIABLE (a simple identifier like 'TEXMF',
- with no '$' or other constructs), expanding '$' (*note Variable
- expansion:: and '~' (*note Tilde expansion::) constructs, but not
- performing other expansions.
+ with no '$' or other constructs), expanding '{...}' (*note Brace
+ expansion::), '$' (*note Variable expansion::) and '~' (*note Tilde
+ expansion::) constructs, considered as strings, but not looking on
+ the filesystem.

File: kpathsea.info, Node: Standard options, Prev: Auxiliary tasks, Up: Invoking kpsewhich
@@ -2911,9 +2912,6 @@ running a normal input file, the problem is usually a compiler bug
passed, problems may lurk. Optimization occasionally causes trouble in
programs other than TeX and Metafont themselves, too.
- Insufficient swap space may also cause core dumps or other erratic
-behavior.
-
For a workaround, if you enabled any optimization flags, it's best to
omit optimization entirely. In any case, the way to find the facts is
to run the program under the debugger and see where it's failing.
@@ -2926,8 +2924,7 @@ also recommend reporting a bug to the GCC mailing list; see *note
To report compiler bugs effectively requires perseverance and
perspicacity: you must find the miscompiled line, and that usually
involves delving backwards in time from the point of error, checking
-through TeX's (or whatever program's) data structures. Things are not
-helped by all-too-common bugs in the debugger itself. Good luck.
+through TeX's (or whatever program's) data structures. Good luck.

File: kpathsea.info, Node: Index, Prev: Reporting bugs, Up: Top
@@ -3195,7 +3192,7 @@ Index
* compiler bugs: TeX or Metafont failing.
(line 6)
* compiler bugs, finding: TeX or Metafont failing.
- (line 24)
+ (line 21)
* conditions for use: Introduction. (line 32)
* config files: Config files. (line 6)
* config files, for Kpathsea-using programs: Calling sequence.
@@ -3360,7 +3357,7 @@ Index
* glyphlist.txt: Specially-recognized files.
(line 25)
* GNU C compiler bugs: TeX or Metafont failing.
- (line 19)
+ (line 16)
* GNU General Public License: Introduction. (line 32)
* group-writable directories: Security. (line 40)
* GSFTOPK_DEBUG (128): Debugging. (line 88)
@@ -3535,7 +3532,7 @@ Index
* OPENTYPEFONTS: Supported file formats.
(line 145)
* optimization caveat: TeX or Metafont failing.
- (line 15)
+ (line 12)
* options for debugging: Debugging. (line 6)
* OTPINPUTS: Supported file formats.
(line 151)
@@ -3669,7 +3666,7 @@ Index
* symbolic links, and ls-R: ls-R. (line 38)
* symlinks, resolving: Calling sequence. (line 31)
* system C compiler bugs: TeX or Metafont failing.
- (line 19)
+ (line 16)
* system-dependent casefolding behavior: Casefolding rationale.
(line 6)
* T1FONTS: Supported file formats.
@@ -3847,61 +3844,61 @@ Index

Tag Table:
Node: Top1480
-Node: Introduction2259
-Node: History4328
-Node: unixtex.ftp8924
-Node: Security10349
-Node: TeX directory structure12853
-Node: Path searching16901
-Node: Searching overview17628
-Node: Path sources21447
-Node: Config files22538
-Node: Path expansion26465
-Node: Default expansion27418
-Node: Variable expansion29488
-Node: Tilde expansion30889
-Node: Brace expansion31869
-Node: KPSE_DOT expansion32794
-Node: Subdirectory expansion33307
-Node: Casefolding search35661
-Node: Casefolding rationale36430
-Node: Casefolding examples37769
-Node: Filename database42819
-Node: ls-R43877
-Node: Filename aliases46772
-Node: Database format47950
-Node: Invoking kpsewhich48963
-Node: Path searching options49918
-Node: Specially-recognized files58437
-Node: Auxiliary tasks59792
-Node: Standard options62131
-Node: TeX support62487
-Node: Supported file formats63841
-Node: File lookup71506
-Node: Glyph lookup73255
-Node: Basic glyph lookup74379
-Node: Fontmap75259
-Node: Fallback font77788
-Node: Suppressing warnings78700
-Node: mktex scripts79827
-Node: mktex configuration81042
-Node: mktex script names86845
-Node: mktex script arguments88231
-Node: Programming89110
-Node: Programming overview89683
-Node: Calling sequence92544
-Node: Program-specific files99076
-Node: Programming with config files100099
-Node: Reporting bugs101411
-Node: Bug checklist102089
-Node: Mailing lists105561
-Node: Debugging106236
-Node: Logging111313
-Node: Common problems113180
-Node: Unable to find files113657
-Node: Slow path searching116067
-Node: Unable to generate fonts117442
-Node: TeX or Metafont failing119913
+Node: Introduction2263
+Node: History4336
+Node: unixtex.ftp8932
+Node: Security10357
+Node: TeX directory structure12861
+Node: Path searching16909
+Node: Searching overview17636
+Node: Path sources21455
+Node: Config files22546
+Node: Path expansion26473
+Node: Default expansion27426
+Node: Variable expansion29496
+Node: Tilde expansion30897
+Node: Brace expansion31877
+Node: KPSE_DOT expansion32816
+Node: Subdirectory expansion33329
+Node: Casefolding search35683
+Node: Casefolding rationale36452
+Node: Casefolding examples37791
+Node: Filename database42841
+Node: ls-R43899
+Node: Filename aliases46794
+Node: Database format47972
+Node: Invoking kpsewhich48985
+Node: Path searching options49940
+Node: Specially-recognized files58459
+Node: Auxiliary tasks59814
+Node: Standard options62282
+Node: TeX support62638
+Node: Supported file formats63992
+Node: File lookup71657
+Node: Glyph lookup73406
+Node: Basic glyph lookup74530
+Node: Fontmap75410
+Node: Fallback font77939
+Node: Suppressing warnings78851
+Node: mktex scripts79978
+Node: mktex configuration81193
+Node: mktex script names86996
+Node: mktex script arguments88382
+Node: Programming89261
+Node: Programming overview89834
+Node: Calling sequence92695
+Node: Program-specific files99227
+Node: Programming with config files100250
+Node: Reporting bugs101562
+Node: Bug checklist102240
+Node: Mailing lists105712
+Node: Debugging106387
+Node: Logging111464
+Node: Common problems113331
+Node: Unable to find files113808
+Node: Slow path searching116218
+Node: Unable to generate fonts117593
+Node: TeX or Metafont failing120064
Node: Index121266

End Tag Table
diff --git a/Build/source/texk/kpathsea/doc/kpathsea.texi b/Build/source/texk/kpathsea/doc/kpathsea.texi
index 999819a516c..8bdf46be39f 100644
--- a/Build/source/texk/kpathsea/doc/kpathsea.texi
+++ b/Build/source/texk/kpathsea/doc/kpathsea.texi
@@ -3,7 +3,7 @@
@settitle Kpathsea: A library for path searching
@set version 6.3.0
-@set month-year July 2018
+@set month-year December 2018
@copying
This file documents the Kpathsea library for path searching.
@@ -919,7 +919,7 @@ foo/@{1,2@}/baz
@end example
@noindent expands to @samp{foo/1/baz:foo/2/baz}. @samp{:} is the path
-separator on the current system; e.g., on a DOS system, it's @samp{;}.
+separator on the current system; e.g., on a Windows system, it's @samp{;}.
Braces can be nested; for example, @samp{x@{A,B@{1,2@}@}y} expands to
@samp{xAy:xB1y:xB2y}.
@@ -934,7 +934,7 @@ assigning a brace list to @code{$TEXMF}, as mentioned in
@file{texmf.in}.
You can also use the path separator instead of the comma. The last
-example could have been written @samp{x@{A:B@}@{1:2@}y}.
+example could have been written @samp{x@{A:B@}@{1:2@}y} (on Unix).
@flindex expand.c
@@ -1769,8 +1769,8 @@ Set debugging options to @var{num}. @xref{Debugging}.
@item --expand-braces=@var{string}
@opindex --expand-braces=@var{string}
-Output variable and brace expansion of @var{string}. @xref{Path
-expansion}.
+Output variable, tilde, and brace expansion of @var{string}, which is
+assumed to be a single path element. @xref{Path expansion}.
@item --expand-path=@var{string}
@opindex --expand-path=@var{string}
@@ -1791,14 +1791,14 @@ $ kpsewhich --expand-path '/nonesuch'
@end example
For one-shot uses of an arbitrary (not built in to Kpathsea) path, see
-@samp{--path} (@pxref{Path searching options})
+@samp{--path} (@pxref{Path searching options}).
@item --expand-var=@var{string}
@opindex --expand-var=@var{string}
-Output the variable and tilde expansion of @var{string}
-the @samp{mktex@dots{}} scripts run @samp{kpsewhich
---expand-var='$TEXMF'} to find the root of the @TeX{} system
-hierarchy. @xref{Path expansion}.
+Output the variable and tilde expansion of @var{string}. For example,
+with the usual @file{texmf.cnf}, @samp{kpsewhich
+--expand-var='$TEXMF'} returns the @TeX{} system hierarchy root(s).
+@xref{Path expansion}.
@item --help-formats
@opindex --help-formats
@@ -1826,8 +1826,9 @@ the previous section.
@opindex --var-value=@var{variable}
Outputs the value of @var{variable} (a simple identifier like
@samp{TEXMF}, with no @samp{$} or other constructs), expanding
-@samp{$} (@pxref{Variable expansion} and @samp{~} (@pxref{Tilde
-expansion}) constructs, but not performing other expansions.
+@samp{@{...@}} (@pxref{Brace expansion}), @samp{$} (@pxref{Variable
+expansion}) and @samp{~} (@pxref{Tilde expansion}) constructs,
+considered as strings, but not looking on the filesystem.
@end table
@@ -3790,9 +3791,6 @@ running a normal input file, the problem is usually a compiler bug
passed, problems may lurk. Optimization occasionally causes trouble in
programs other than @TeX{} and Metafont themselves, too.
-Insufficient swap space may also cause core dumps or other erratic
-behavior.
-
@cindex optimization caveat
For a workaround, if you enabled any optimization flags, it's best to
omit optimization entirely. In any case, the way to find the facts is
@@ -3809,8 +3807,7 @@ Using and Porting GNU CC}.
To report compiler bugs effectively requires perseverance and
perspicacity: you must find the miscompiled line, and that usually
involves delving backwards in time from the point of error, checking
-through @TeX{}'s (or whatever program's) data structures. Things are
-not helped by all-too-common bugs in the debugger itself. Good luck.
+through @TeX{}'s (or whatever program's) data structures. Good luck.
@node Index
diff --git a/Build/source/texk/kpathsea/kpsewhich.c b/Build/source/texk/kpathsea/kpsewhich.c
index 30680cc5df2..d78f098f657 100644
--- a/Build/source/texk/kpathsea/kpsewhich.c
+++ b/Build/source/texk/kpathsea/kpsewhich.c
@@ -493,7 +493,7 @@ to also use -engine, or nothing will be returned; in particular,\n\
-show-path=TYPE output search path for file type TYPE\n\
(list shown by -help-formats).\n\
-subdir=STRING only output matches whose directory ends with STRING.\n\
--var-value=STRING output the value of variable $STRING.\n\
+-var-value=STRING output the expanded value of variable $STRING.\n\
-version display version information number and exit.\n \
"
@@ -824,7 +824,7 @@ main (int argc, string *argv)
}
puts (kpse->format_info[user_format].path);
} else {
- WARNING1 ("kpsewhich: Unknown file type, cannot show path:",
+ WARNING1 ("kpsewhich: Unknown file type, cannot show path: ",
path_to_show);
}
}
@@ -836,6 +836,12 @@ main (int argc, string *argv)
unfound++;
value = "";
}
+ /* It is helpful for users to output the fully-expanded (as a
+ string, no filesystem checks) value. We can't call brace_expand
+ as part of kpathsea_var_value, though, because unfortunately it
+ is not reentrant. We use var_value in lots of places in the
+ source, and it clobbers the static buffer in the kpse structure. */
+ value = kpathsea_brace_expand (kpse, value);
puts (value);
}
diff --git a/Build/source/texk/kpathsea/path-elt.c b/Build/source/texk/kpathsea/path-elt.c
index b678bdf4cf2..5666e30b615 100644
--- a/Build/source/texk/kpathsea/path-elt.c
+++ b/Build/source/texk/kpathsea/path-elt.c
@@ -1,6 +1,6 @@
/* path-elt.c: return the stuff between colons.
- Copyright 1993, 1996 2008, 2016 Karl Berry.
+ Copyright 1993, 1996, 2008, 2016, 2018 Karl Berry.
Copyright 1997, 2001, 2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -28,7 +28,7 @@
thus, we parse the same path over and over, on every lookup. If that
turns out to be a significant lose, it can be fixed, but I'm guessing
disk accesses overwhelm everything else. If ENV_P is true, use
- IS_ENV_SEP; else use IS_DIR_SEP. */
+ IS_KPSE_SEP; else use IS_DIR_SEP. */
static string
element (kpathsea kpse, const_string passed_path, boolean env_p)
@@ -49,10 +49,16 @@ element (kpathsea kpse, const_string passed_path, boolean env_p)
assert (kpse->path);
p = kpse->path;
- /* Find the next colon not enclosed by braces (or the end of the path). */
+ /* Find the next path separator not enclosed by braces (or the end of
+ the path). Here we want to check for either : or ; because we might
+ be called with the ;-using paths from the default texmf.cnf, e.g.,
+ with kpsewhich --expand-braces or kpsewhich --var-value, while on a
+ Unix system. Otherwise, the path elements are not parsed and thus ~
+ expansion (for example), does not happen except on the first element.
+ https://github.com/TeX-Live/texlive-source/issues/3 */
brace_level = 0;
- while (*p != 0 && !(brace_level == 0
- && (env_p ? IS_ENV_SEP (*p) : IS_DIR_SEP (*p)))) {
+ while (*p != 0 && !(brace_level == 0
+ && (env_p ? IS_KPSE_SEP (*p) : IS_DIR_SEP (*p)))) {
if (*p == '{') ++brace_level;
else if (*p == '}') --brace_level;
#if defined(WIN32)
diff --git a/Build/source/texk/kpathsea/pathsearch.h b/Build/source/texk/kpathsea/pathsearch.h
index 7b4d5a7920e..057c6c92c03 100644
--- a/Build/source/texk/kpathsea/pathsearch.h
+++ b/Build/source/texk/kpathsea/pathsearch.h
@@ -1,7 +1,7 @@
/* pathsearch.h: mostly-generic path searching.
Copyright 1993, 1994, 1996, 1997, 2007, 2008, 2009, 2011, 2012,
- 2014 Karl Berry.
+ 2014, 2018 Karl Berry.
Copyright 1999-2005 Olaf Weber.
This library is free software; you can redistribute it and/or
@@ -36,7 +36,7 @@ extern "C" {
#ifdef MAKE_KPSE_DLL /* libkpathsea internal only */
/* If PATH is non-null, return its first element (as defined by
- IS_ENV_SEP). If it's NULL, return the next element in the previous
+ IS_KPSE_SEP). If it's NULL, return the next element in the previous
path, a la strtok. Leading, trailing, or doubled colons result in
the empty string. When at the end of PATH, return NULL. In any
case, return a pointer to an area that may be overwritten on
@@ -47,10 +47,9 @@ extern string kpathsea_path_element (kpathsea kpse, const_string path);
IS_DIR_SEP). Uses same area as `kpathsea_path_element'. */
extern string kpathsea_filename_component (kpathsea kpse, const_string path);
-/*
- This function may rewrite its argument to avoid bugs when calling
- stat() or equivalent under Win32. Also, it returns the index after
- which the program should start to look for expandable constructs. */
+/* This function may rewrite its argument to avoid bugs when calling
+ stat() or equivalent under Windows. Also, it returns the index after
+ which the program should start to look for expandable constructs. */
extern unsigned kpathsea_normalize_path (kpathsea kpse, string elt);
/* Given a path element ELT, return a pointer to a NULL-terminated list
@@ -61,8 +60,7 @@ extern unsigned kpathsea_normalize_path (kpathsea kpse, string elt);
It's up to the caller to expand ELT. This is because this routine is
most likely only useful to be called from `kpathsea_path_search', which
has already assumed expansion has been done. */
-extern str_llist_type *kpathsea_element_dirs (kpathsea kpse,
- string elt);
+extern str_llist_type *kpathsea_element_dirs (kpathsea kpse, string elt);
#endif /* MAKE_KPSE_DLL */