Skip to content

Commit bd27bb9

Browse files
committedAug 12, 2021
8272345: macos doesn't check os::set_boot_path() result
Reviewed-by: dholmes
1 parent 44f137f commit bd27bb9

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed
 

‎src/hotspot/os/bsd/os_bsd.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,9 @@ void os::init_system_properties_values() {
452452
}
453453
}
454454
Arguments::set_java_home(buf);
455-
set_boot_path('/', ':');
455+
if (!set_boot_path('/', ':')) {
456+
vm_exit_during_initialization("Failed setting boot class path.", NULL);
457+
}
456458
}
457459

458460
// Where to look for native libraries.

‎test/hotspot/jtreg/runtime/cds/appcds/MoveJDKTest.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@
2525
/*
2626
* @test
2727
* @summary Test that CDS still works when the JDK is moved to a new directory
28+
* @bug 8272345
2829
* @requires vm.cds
29-
* @requires os.family == "linux"
30+
* @comment This test doesn't work on Windows because it depends on symlinks
31+
* @requires os.family != "windows"
3032
* @library /test/lib
3133
* @compile test-classes/Hello.java
3234
* @run driver MoveJDKTest
3335
*/
3436

35-
// This test works only on Linux because it depends on symlinks and the name of the hotspot DLL (libjvm.so).
36-
// It probably doesn't work on Windows.
37-
// TODO: change libjvm.so to libjvm.dylib on MacOS, before adding "@requires os.family == mac"
38-
3937
import java.io.File;
4038
import java.nio.file.Files;
4139
import java.nio.file.Path;
@@ -134,6 +132,7 @@ static void clone(File src, File dst) throws Exception {
134132
throw new RuntimeException("Cannot create directory: " + dst);
135133
}
136134
}
135+
final String jvmLib = System.mapLibraryName("jvm");
137136
for (String child : src.list()) {
138137
if (child.equals(".") || child.equals("..")) {
139138
continue;
@@ -145,7 +144,7 @@ static void clone(File src, File dst) throws Exception {
145144
throw new RuntimeException("Already exists: " + child_dst);
146145
}
147146
if (child_src.isFile()) {
148-
if (child.equals("libjvm.so") || child.equals("java")) {
147+
if (child.equals(jvmLib) || child.equals("java")) {
149148
Files.copy(child_src.toPath(), /* copy data to -> */ child_dst.toPath());
150149
} else {
151150
Files.createSymbolicLink(child_dst.toPath(), /* link to -> */ child_src.toPath());

0 commit comments

Comments
 (0)
Please sign in to comment.