From 0e31c4fdf02057bc2e69a429d8f3a6cc10ceea3a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 4 Jul 2008 16:37:38 +0000 Subject: remove system-dependent program_invocation_name behavior in kpse_set_program_name; found by mpg git-svn-id: svn://tug.org/texlive/trunk@9244 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 6 +++ Build/source/texk/kpathsea/kpathsea.info | 81 +++++++++++++++++--------------- Build/source/texk/kpathsea/kpathsea.texi | 31 ++++++------ Build/source/texk/kpathsea/progname.c | 21 +++++---- 4 files changed, 78 insertions(+), 61 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 1b97e0325ea..bc379aa92d1 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,9 @@ +2008-07-04 Karl Berry + + * progname.c [HAVE_PROGRAM_INVOCATION_NAME]: remove all #ifdef's + except around the declaration, so that we always use our own code + to compute them. This avoids painful system dependencies. + 2008-07-02 Karl Berry * mktexlsr: doc fix. diff --git a/Build/source/texk/kpathsea/kpathsea.info b/Build/source/texk/kpathsea/kpathsea.info index 20fae354fc1..5b3b516a974 100644 --- a/Build/source/texk/kpathsea/kpathsea.info +++ b/Build/source/texk/kpathsea/kpathsea.info @@ -3514,19 +3514,22 @@ this: `NULL', the value of the first argument is used. This function must be called before any other use of the Kpathsea library. - If necessary, `kpse_set_program_name' sets the global variables + `kpse_set_program_name' always sets the global variables `program_invocation_name' and `program_invocation_short_name'. These variables are used in the error message macros defined in `kpathsea/lib.h'. It sets the global variable `kpse_program_name' - to the program name it uses. It also initializes debugging - options based on the environment variable `KPATHSEA_DEBUG' (if - that is set). Finally, it sets the variables `SELFAUTOLOC', - `SELFAUTODIR' and `SELFAUTOPARENT' to the location, parent and - grandparent directory of the executable, removing `.' and `..' - path elements and resolving symbolic links. These are used in the - default configuration file to allow people to invoke TeX from - anywhere, specifically from a mounted CD-ROM. (You can use - `--expand-var=\$SELFAUTOLOC', etc., to see the values finds.) + to the program name it uses. + + It also initializes debugging options based on the environment + variable `KPATHSEA_DEBUG' (if that is set). + + Finally, it sets the variables `SELFAUTOLOC', `SELFAUTODIR' and + `SELFAUTOPARENT' to the location, parent and grandparent directory + of the executable, removing `.' and `..' path elements and + resolving symbolic links. These are used in the default + configuration file to allow people to invoke TeX from anywhere. + You can use `kpsewhich --expand-var=\$SELFAUTOLOC', etc., to see + the values. 2. The `kpse_set_progname' is deprecated. A call to `kpse_set_progname' with `argv[0]' is equivalent to a call of @@ -3845,7 +3848,7 @@ Index (line 6) * argv[0]: Calling sequence. (line 9) * ash, losing with configure: configure shells. (line 19) -* autoconf, recommended: Calling sequence. (line 90) +* autoconf, recommended: Calling sequence. (line 93) * automounter, and configuration: configure scenarios. (line 29) * automounter, and ls-R: ls-R. (line 40) * auxiliary tasks: Auxiliary tasks. (line 6) @@ -3873,7 +3876,7 @@ Index * bug checklist: Bug checklist. (line 6) * bug mailing list: Mailing lists. (line 6) * bugs, reporting: Reporting bugs. (line 6) -* c-*.h: Calling sequence. (line 90) +* c-*.h: Calling sequence. (line 93) * c-auto.h: Programming overview. (line 25) * c-auto.in: Running configure. (line 6) @@ -3894,7 +3897,7 @@ Index (line 16) * circle fonts: Fontmap. (line 19) * clean Make target: Cleaning up. (line 15) -* client_path in kpse_format_info: Calling sequence. (line 45) +* client_path in kpse_format_info: Calling sequence. (line 48) * CMAPFONTS: Supported file formats. (line 36) * cmr10, as fallback font: Fallback font. (line 15) @@ -3926,7 +3929,7 @@ Index * conditions for use: Introduction. (line 31) * config files: Config files. (line 6) * config files, for Kpathsea-using programs: Calling sequence. - (line 45) + (line 48) * config files, programming with: Programming with config files. (line 6) * config.h: Programming overview. @@ -3969,7 +3972,7 @@ Index * debugger: Bug checklist. (line 62) * debugging: Debugging. (line 6) * debugging options, in Kpathsea-using program: Calling sequence. - (line 37) + (line 40) * debugging output: Debugging. (line 27) * debugging with -g, disabling: configure scenarios. (line 32) * DEC shells and configure: configure shells. (line 25) @@ -4053,7 +4056,7 @@ Index * error message macros: Calling sequence. (line 16) * excessive startup time: Slow path searching. (line 6) * expand.c: Brace expansion. (line 26) -* expanding symlinks: Calling sequence. (line 16) +* expanding symlinks: Calling sequence. (line 25) * expansion, default: Default expansion. (line 6) * expansion, path element: Searching overview. (line 43) * expansion, search path: Path expansion. (line 6) @@ -4142,7 +4145,7 @@ Index * group-writable directories: Security. (line 40) * GSFTOPK_DEBUG (128): Debugging. (line 88) * hash table buckets, printing: Debugging. (line 105) -* hash table routines: Calling sequence. (line 83) +* hash table routines: Calling sequence. (line 86) * hash_summary_only variable for debugging: Debugging. (line 105) * help, mailing list for general TeX: Mailing lists. (line 29) * HIER: Default path features. @@ -4159,7 +4162,7 @@ Index * INDEXSTYLE: Supported file formats. (line 67) * info-tex@shsu.edu: Mailing lists. (line 29) -* input lines, reading: Calling sequence. (line 83) +* input lines, reading: Calling sequence. (line 86) * install-data Make target: Installing files. (line 28) * install-exec Make target: Installing files. (line 23) * installation: Installation. (line 6) @@ -4194,11 +4197,11 @@ Index * kpathsea/HIER: Default path features. (line 41) * kpathsea/README.CONFIGURE: Running configure. (line 15) -* KPATHSEA_DEBUG: Calling sequence. (line 16) +* KPATHSEA_DEBUG: Calling sequence. (line 22) * kpathsea_debug: Debugging. (line 18) * KPATHSEA_DEBUG: Debugging. (line 18) * kpathsea_debug: Debugging. (line 6) -* kpathsea_debug variable: Calling sequence. (line 37) +* kpathsea_debug variable: Calling sequence. (line 40) * KPATHSEA_WARNING: Config files. (line 18) * KPSE_BITMAP_TOLERANCE: Basic glyph lookup. (line 15) * kpse_cnf_get: Programming with config files. @@ -4212,18 +4215,18 @@ Index * KPSE_DEBUG_VARS (64): Debugging. (line 83) * KPSE_DOT expansion: KPSE_DOT expansion. (line 6) * kpse_fallback_font: Fallback font. (line 15) -* kpse_find_*: Calling sequence. (line 60) -* kpse_find_file <1>: Calling sequence. (line 60) +* kpse_find_*: Calling sequence. (line 63) +* kpse_find_file <1>: Calling sequence. (line 63) * kpse_find_file: File lookup. (line 37) * kpse_find_glyph_format: Glyph lookup. (line 26) -* kpse_format_info: Calling sequence. (line 45) +* kpse_format_info: Calling sequence. (line 48) * kpse_format_info_type: Debugging. (line 61) -* kpse_init_prog: Calling sequence. (line 51) +* kpse_init_prog: Calling sequence. (line 54) * kpse_init_prog, and MAKETEX_MODE: Default path features. (line 25) -* kpse_open_file: Calling sequence. (line 74) +* kpse_open_file: Calling sequence. (line 77) * kpse_program_name: Calling sequence. (line 16) -* kpse_set_progname: Calling sequence. (line 30) +* kpse_set_progname: Calling sequence. (line 33) * kpse_set_program_name: Calling sequence. (line 9) * kpse_var_value: Programming with config files. (line 10) @@ -4253,7 +4256,7 @@ Index * license for using the library: Introduction. (line 31) * LIGFONTS: Supported file formats. (line 71) -* lines, reading arbitrary-length: Calling sequence. (line 83) +* lines, reading arbitrary-length: Calling sequence. (line 86) * Linux File System Standard: mktex configuration. (line 114) * Linux shells and configure: configure shells. (line 19) * Linux, using Web2c: CD-ROM distribution. (line 16) @@ -4289,7 +4292,7 @@ Index * MAKETEX_FINE_DEBUG (1024): Debugging. (line 100) * MAKETEX_MODE: Default path features. (line 19) -* memory allocation routines: Calling sequence. (line 83) +* memory allocation routines: Calling sequence. (line 86) * metafont driver files: mktex configuration. (line 94) * Metafont failures: TeX or Metafont failing. (line 6) @@ -4458,7 +4461,7 @@ Index * problems, common: Common problems. (line 6) * proginit.c: Default path features. (line 25) -* proginit.h: Calling sequence. (line 51) +* proginit.h: Calling sequence. (line 54) * program-varying paths: Supported file formats. (line 12) * program_invocation_name: Calling sequence. (line 16) @@ -4477,7 +4480,7 @@ Index * quoting variable values: Variable expansion. (line 17) * readable: Suppressing warnings. (line 26) -* reading arbitrary-length lines: Calling sequence. (line 83) +* reading arbitrary-length lines: Calling sequence. (line 86) * README.CONFIGURE: Running configure. (line 15) * README.mirrors: Electronic distribution. (line 13) @@ -4485,7 +4488,7 @@ Index * relative filenames: Searching overview. (line 52) * relative filenames in ls-R: Installing files. (line 40) * reporting bugs: Reporting bugs. (line 6) -* resident.c: Calling sequence. (line 45) +* resident.c: Calling sequence. (line 48) * resolution, setting: Path searching options. (line 17) * resolutions, last-resort: Fallback font. (line 6) @@ -4507,9 +4510,9 @@ Index * searching the disk: Searching overview. (line 22) * security considerations: Security. (line 6) * sed error from configure: Empty Makefiles. (line 6) -* SELFAUTODIR: Calling sequence. (line 16) -* SELFAUTOLOC: Calling sequence. (line 16) -* SELFAUTOPARENT: Calling sequence. (line 16) +* SELFAUTODIR: Calling sequence. (line 25) +* SELFAUTOLOC: Calling sequence. (line 25) +* SELFAUTOPARENT: Calling sequence. (line 25) * sending patches: Bug checklist. (line 56) * setgid scripts: Security. (line 40) * SFDFONTS: Supported file formats. @@ -4542,7 +4545,7 @@ Index * startup time, excessive: Slow path searching. (line 6) * static linking: ShellWidgetClass. (line 39) * static linking and dlsym: dlopen. (line 6) -* string routines: Calling sequence. (line 83) +* string routines: Calling sequence. (line 86) * strip: mktex configuration. (line 108) * stripsupplier: mktex configuration. (line 102) * striptypeface: mktex configuration. (line 105) @@ -4562,7 +4565,7 @@ Index * symbolic links not found: Unable to find files. (line 21) * symbolic links, and ls-R: ls-R. (line 38) -* symlinks, resolving: Calling sequence. (line 16) +* symlinks, resolving: Calling sequence. (line 25) * system C compiler bugs: TeX or Metafont failing. (line 19) * system dependencies: Running configure. (line 6) @@ -4846,8 +4849,8 @@ Node: Suppressing warnings136081 Node: Programming137186 Node: Programming overview137699 Node: Calling sequence139975 -Node: Program-specific files145004 -Node: Programming with config files146042 -Node: Index147342 +Node: Program-specific files144967 +Node: Programming with config files146005 +Node: Index147305  End Tag Table diff --git a/Build/source/texk/kpathsea/kpathsea.texi b/Build/source/texk/kpathsea/kpathsea.texi index a40e3f706c0..c75a8cf3fe4 100644 --- a/Build/source/texk/kpathsea/kpathsea.texi +++ b/Build/source/texk/kpathsea/kpathsea.texi @@ -2266,26 +2266,29 @@ Kpathsea library. @vindex program_invocation_name @vindex program_invocation_short_name @vindex kpse_program_name +@cindex error message macros +@code{kpse_set_program_name} always sets the global variables +@code{program_invocation_name} and @code{program_invocation_short_name}. +These variables are used in the error message macros defined in +@file{kpathsea/lib.h}. It sets the global variable +@code{kpse_program_name} to the program name it uses. + @vindex KPATHSEA_DEBUG +It also initializes debugging options based on the environment +variable @code{KPATHSEA_DEBUG} (if that is set). + @cindex SELFAUTOLOC @cindex SELFAUTODIR @cindex SELFAUTOPARENT -@cindex error message macros @cindex symlinks, resolving @cindex expanding symlinks -If necessary, @code{kpse_set_program_name} sets the global variables -@code{program_invocation_name} and @code{program_invocation_short_name}. -These variables are used in the error message macros defined in -@file{kpathsea/lib.h}. It sets the global variable -@code{kpse_program_name} to the program name it uses. It also -initializes debugging options based on the environment variable -@code{KPATHSEA_DEBUG} (if that is set). Finally, it sets the variables -@code{SELFAUTOLOC}, @code{SELFAUTODIR} and @code{SELFAUTOPARENT} to the -location, parent and grandparent directory of the executable, removing -@file{.} and @file{..} path elements and resolving symbolic links. -These are used in the default configuration file to allow people to -invoke TeX from anywhere, specifically from a mounted CD-ROM. (You can -use @samp{--expand-var=\$SELFAUTOLOC}, etc., to see the values finds.) +Finally, it sets the variables @code{SELFAUTOLOC}, @code{SELFAUTODIR} +and @code{SELFAUTOPARENT} to the location, parent and grandparent +directory of the executable, removing @file{.} and @file{..} path +elements and resolving symbolic links. These are used in the default +configuration file to allow people to invoke TeX from anywhere. You +can use @samp{kpsewhich --expand-var=\$SELFAUTOLOC}, etc., to see the +values. @item @findex kpse_set_progname diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c index 42894ca2c18..253d54bd2db 100644 --- a/Build/source/texk/kpathsea/progname.c +++ b/Build/source/texk/kpathsea/progname.c @@ -69,10 +69,21 @@ #endif #ifndef HAVE_PROGRAM_INVOCATION_NAME -/* Don't redefine the variables if glibc already has. */ +/* Don't redefine the variables if glibc already has. However, we do + not check for HAVE_PROGRAM_INVOCATION_NAME anywhere else in this + file; rather, we always use our own code to compute them, overwriting + anything that glibc may have provided. This avoids + difficult-to-debug system-dependent behavior, and also universally + supports the second (`progname') argument for dotted texmf.cnf values. + + It would have been better to simply use our own variable names (and + computations) in the first place, but it's not worth losing backward + compatibility to rename them now. */ + string program_invocation_name = NULL; string program_invocation_short_name = NULL; #endif + /* And the variable for the program we pretend to be. */ string kpse_program_name = NULL; @@ -430,7 +441,6 @@ kpse_set_program_name P2C(const_string, argv0, const_string, progname) kpathsea_debug |= atoi (s); } -#ifndef HAVE_PROGRAM_INVOCATION_NAME #if defined(WIN32) /* Set various info about user. Among many things, ensure that HOME is set. If debug_paths is on, @@ -551,11 +561,8 @@ kpse_set_program_name P2C(const_string, argv0, const_string, progname) program_invocation_name = xstrdup (argv0); #else /* !WIN32 && !__DJGPP__ */ - program_invocation_name = xstrdup (argv0); - #endif -#endif /* not HAVE_PROGRAM_INVOCATION_NAME */ /* We need to find SELFAUTOLOC *before* removing the ".exe" suffix from the program_name, otherwise the PATH search inside selfdir will fail, @@ -575,9 +582,7 @@ kpse_set_program_name P2C(const_string, argv0, const_string, progname) free (sdir_parent); free (sdir_grandparent); -#ifndef HAVE_PROGRAM_INVOCATION_NAME program_invocation_short_name = (string)xbasename (program_invocation_name); -#endif if (progname) { kpse_program_name = xstrdup (progname); @@ -594,7 +599,7 @@ kpse_set_program_name P2C(const_string, argv0, const_string, progname) } } - xputenv("progname", kpse_program_name); + xputenv ("progname", kpse_program_name); } /* This function is deprecated, because when we pretend to have a different -- cgit v1.2.3