Thomas Fitzsimmons writes:
> +
> + // Check if LD_LIBRARY_PATH is already prefixed with
> + // GCJ_VERSIONED_LIBDIR. If not, export LD_LIBRARY_PATH prefixed
> + // with GCJ_VERSIONED_LIBDIR and re-spawn gij.
> + char *libpath = getenv (LTDL_SHLIBPATH_VAR);
> + char *newpath = _Jv_PrependVersionedLibdir (libpath);
> +
> + if (! libpath || strcmp (libpath, newpath))
> + {
> + setenv (LTDL_SHLIBPATH_VAR, newpath, 1);
> + JvFree (newpath);
> +
> + int error_code = execv (GIJ_EXECUTABLE, (char* const*) argv);
But, as discussed with Bryce, the version in svn is
int error_code = execvp (argv[0], (char* const*) argv);
This can break java-1.4.2-gcj-compat.
/usr/bin/java prefixes the LD_LIBRARY_PATH with the gij install dir.
Then, /usr/bin/java does an execv of PREFIX/gij, but it leaves argv[0]
pointing to /usr/bin/java rather than PREFIX/gij.
So, when you call execvp(), the /usr/bin/java wrapper is re-executed,
not gij. This in turn, re-executes gij, ad nauseam.
So, to make this clear:
/usr/bin/java prefixes LD_LIBRARY_PATH and execs gij
gij prefixes LD_LIBRARY_PATH and execs /usr/bin/java
/usr/bin/java prefixes LD_LIBRARY_PATH and execs gij
gij prefixes LD_LIBRARY_PATH and execs /usr/bin/java
...