nixpkgs/pkgs/development/compilers/openjdk/fix-library-path-jdk17.patch
2022-07-29 22:05:54 +04:00

60 lines
2.4 KiB
Diff

--- a/src/hotspot/os/linux/os_linux.cpp
+++ b/src/hotspot/os/linux/os_linux.cpp
@@ -412,18 +412,8 @@ void os::init_system_properties_values() {
// 1: ...
// ...
// 7: The default directories, normally /lib and /usr/lib.
-#ifndef OVERRIDE_LIBPATH
- #if defined(_LP64)
- #define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib"
- #else
- #define DEFAULT_LIBPATH "/lib:/usr/lib"
- #endif
-#else
- #define DEFAULT_LIBPATH OVERRIDE_LIBPATH
-#endif
// Base path of extensions installed on the system.
-#define SYS_EXT_DIR "/usr/java/packages"
#define EXTENSIONS_DIR "/lib/ext"
// Buffer that fits several sprintfs.
@@ -431,7 +421,7 @@ void os::init_system_properties_values() {
// by the nulls included by the sizeof operator.
const size_t bufsize =
MAX2((size_t)MAXPATHLEN, // For dll_dir & friends.
- (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
+ (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
char *buf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// sysclasspath, java_home, dll_dir
@@ -478,26 +468,22 @@ void os::init_system_properties_values() {
// should always exist (until the legacy problem cited above is
// addressed).
const char *v = ::getenv("LD_LIBRARY_PATH");
- const char *v_colon = ":";
- if (v == NULL) { v = ""; v_colon = ""; }
+ if (v == NULL) { v = ""; }
// That's +1 for the colon and +1 for the trailing '\0'.
char *ld_library_path = NEW_C_HEAP_ARRAY(char,
- strlen(v) + 1 +
- sizeof(SYS_EXT_DIR) + sizeof("/lib/") + sizeof(DEFAULT_LIBPATH) + 1,
+ strlen(v) + 1,
mtInternal);
- sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib:" DEFAULT_LIBPATH, v, v_colon);
+ sprintf(ld_library_path, "%s", v);
Arguments::set_library_path(ld_library_path);
FREE_C_HEAP_ARRAY(char, ld_library_path);
}
// Extensions directories.
- sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
+ sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
Arguments::set_ext_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf);
-#undef DEFAULT_LIBPATH
-#undef SYS_EXT_DIR
#undef EXTENSIONS_DIR
}