diff options
Diffstat (limited to 'Build/source/texk/kpathsea')
-rw-r--r-- | Build/source/texk/kpathsea/.gdbinit | 7 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/default.h | 2 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/kpsewhich.c | 6 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/tex-file.c | 44 |
5 files changed, 38 insertions, 29 deletions
diff --git a/Build/source/texk/kpathsea/.gdbinit b/Build/source/texk/kpathsea/.gdbinit index cd6be579252..6f14830bb43 100644 --- a/Build/source/texk/kpathsea/.gdbinit +++ b/Build/source/texk/kpathsea/.gdbinit @@ -7,8 +7,13 @@ set env TEXMFCNF /home/texlive/karl/Master/texmf/web2c set env TEXMFDBS /home/texlive/karl/Master/texmf-dist set env TEXINPUTS !!/home/texlive/karl/Master/texmf-dist/tex/latex// set args --all --subdir=latex/arabtex --subdir=ledmac afoot.sty -# + # preload.cfg #set env TEXMFDBS /home/texlive/karl/Master/texmf #set env TEXINPUTS !!/home/texlive/karl/Master/texmf/tex/generic//:!!/home/texlive/karl/Master/texmf/tex// # --debug=32 + +# garbage in debug output, vvv 13 May 2008 02:25:06 +# mkdir -p ~/test1/test2/test3/tex +set env TEXINPUTS ~/test1/test2/test3/tex +set args -debug=8 texmf.cnf diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index f5bd1a708fd..b9d755e310b 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,6 +1,12 @@ 2008-05-23 Karl Berry <karl@tug.org> - * kpsewhich.c (find_format): use the right formats for + * tex-file.c (init_path): do not free the translated env_value, + else raw_path ends up pointing to that freed memory. + + * default.h: mention that result is always in new memory. + * kpsewhich.c: recognize texmf.cnf as kpse_cnf_format. + + * kpsewhich.c (find_format): use the right formats for texmf.cnf, dvipdfmx.cfg, fmtutil.cnf, mktex.cnf, and updmap.cfg (as well as config.ps, earlier). Same values as texmf/texconfig/tcfmgr.map. diff --git a/Build/source/texk/kpathsea/default.h b/Build/source/texk/kpathsea/default.h index 90e9fa6d4ac..75013828bb3 100644 --- a/Build/source/texk/kpathsea/default.h +++ b/Build/source/texk/kpathsea/default.h @@ -24,7 +24,7 @@ /* Replace a leading or trailing or doubled : in PATH with DFLT. If no extra colons, return PATH. Only one extra colon is replaced. - DFLT may not be NULL. */ + DFLT may not be NULL. The result is always in new memory. */ extern string kpse_expand_default P2H(const_string path, const_string dflt); diff --git a/Build/source/texk/kpathsea/kpsewhich.c b/Build/source/texk/kpathsea/kpsewhich.c index 91531189c94..51e032b6f50 100644 --- a/Build/source/texk/kpathsea/kpsewhich.c +++ b/Build/source/texk/kpathsea/kpsewhich.c @@ -112,6 +112,8 @@ find_format P2C(string, name, boolean, is_filename) ret = kpse_fontmap_format; } else if (FILESTRCASEEQ (name, "pdftex.cfg")) { ret = kpse_pdftex_config_format; + } else if (FILESTRCASEEQ (name, "texmf.cnf")) { + ret = kpse_cnf_format; } else if (FILESTRCASEEQ (name, "updmap.cfg")) { ret = kpse_web2c_format; } else { @@ -133,7 +135,7 @@ find_format P2C(string, name, boolean, is_filename) boolean found = false; if (!kpse_format_info[f].type) - kpse_init_format ((kpse_file_format_type)f); + kpse_init_format ((kpse_file_format_type) f); if (!is_filename) { /* Allow the long name, but only in the -format option. We don't @@ -492,7 +494,7 @@ main P2C(int, argc, string *, argv) kpse_set_program_name (argv[0], progname); if (engine) - xputenv("engine", engine); + xputenv ("engine", engine); /* NULL for no fallback font. */ kpse_init_prog (uppercasify (kpse_program_name), dpi, mode, NULL); diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index ba0449b6f80..102d4ee1949 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -197,9 +197,9 @@ kpse_maketex_option P2C(const_string, fmtname, boolean, value) present info->path. */ #define EXPAND_DEFAULT(try_path, source_string) \ if (try_path) { \ - info->raw_path = try_path; \ - info->path = kpse_expand_default (try_path, info->path); \ - info->path_source = source_string; \ + info->raw_path = try_path; \ + info->path = kpse_expand_default (try_path, info->path); \ + info->path_source = source_string; \ } /* Find the final search path to use for the format entry INFO, given @@ -225,22 +225,19 @@ init_path PVAR2C(kpse_format_info_type *, info, const_string, default_path, ap) while ((env_name = va_arg (ap, string)) != NULL) { /* Since sh doesn't like envvar names with `.', check PATH_prog as well as PATH.prog. */ - if (!var) { - /* Try PATH.prog. */ + if (!var) { /* Try PATH.prog. */ string evar = concat3 (env_name, ".", kpse_program_name); env_value = getenv (evar); if (env_value && *env_value) { var = evar; - } else { + } else { /* Try PATH_prog. */ free (evar); - /* Try PATH_prog. */ evar = concat3 (env_name, "_", kpse_program_name); env_value = getenv (evar); if (env_value && *env_value) { var = evar; - } else { + } else { /* Try simply PATH. */ free (evar); - /* Try simply PATH. */ env_value = getenv (env_name); if (env_value && *env_value) { var = env_name; @@ -269,26 +266,26 @@ init_path PVAR2C(kpse_format_info_type *, info, const_string, default_path, ap) info->path = info->raw_path = info->default_path; info->path_source = "compile-time paths.h"; - /* Translate ';' in the envvar into ':' if that's our ENV_SEP. */ - if (IS_ENV_SEP(':') && env_value) { + EXPAND_DEFAULT (info->cnf_path, "texmf.cnf"); + EXPAND_DEFAULT (info->client_path, "program config file"); + + if (var) { + /* Translate `;' in the envvar into `:' if that's our ENV_SEP. */ + if (IS_ENV_SEP (':')) { string loc; - env_value = xstrdup(env_value); /* Freed below. */ + env_value = xstrdup (env_value); /* Freed below. */ for (loc = env_value; *loc; loc++) { - if (*loc == ';') - *loc = ':'; + if (*loc == ';') + *loc = ':'; } - } - - EXPAND_DEFAULT (info->cnf_path, "texmf.cnf"); - EXPAND_DEFAULT (info->client_path, "program config file"); - if (var) + } EXPAND_DEFAULT (env_value, concat (var, " environment variable")); + /* Do not free the copied env_value, because EXPAND_DEFAULT set + raw_path to point to it. If it gets overwritten again, tough. */ + } + EXPAND_DEFAULT (info->override_path, "application override variable"); info->path = kpse_brace_expand (info->path); - - /* Free the copied env_value. */ - if (IS_ENV_SEP(':') && env_value) - free(env_value); }} @@ -316,7 +313,6 @@ kpse_set_suffixes PVAR2C(kpse_file_format_type, format, } va_end (ap); (*list)[count] = NULL; - }} /* The path spec we are defining, one element of the global array. */ |