openjdk17: Remove default java.library.path

see #103493
This commit is contained in:
Benjamin Asbach 2022-07-29 22:04:34 +04:00
parent 2a93ea177c
commit e937b6e3ba
2 changed files with 61 additions and 0 deletions

View File

@ -41,6 +41,7 @@ let
./currency-date-range-jdk10.patch
./increase-javadoc-heap-jdk13.patch
./ignore-LegalNoticeFilePlugin.patch
./fix-library-path-jdk17.patch
# -Wformat etc. are stricter in newer gccs, per
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79677

View File

@ -0,0 +1,60 @@
--- 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
}