Building OpenJDK with --with-vendor-name="Foo bar öÜß" results in the JDK build having baked in VM vendor information. Say, the build was done on an UTF-8 system. Such a build would then not correctly render the non-modifiable java.vendor or java.vm.vendor properties. E.g. as shown by the -XshowSettings:properties output. This is noticeable when running in containers with volume mounts:
$ cat test-class/Test.java
void main() {
IO.println("java.vm.vendor=" + System.getProperty("java.vm.vendor"));
}
$ podman run --rm -ti -v $(pwd)/build/linux-x86_64-server-release/images/jdk:/opt/jdk:z -v $(pwd)/test-class:/classes:z fedora:42 /opt/jdk/bin/java -cp /classes Test
java.vm.vendor=Foo bar ??????
The reason for this is that the container uses the POSIX locale which amounts to an US-ASCII encoder being used when retrieving the string while the build embeds the vendor string in UTF-8 (in gensrc/java.base/java/lang/VersionProps.java). A mismatch.
Work-around: Set -e LANG=C.UTF.8 when running the container:
$ podman run --rm -ti -e LANG=C.UTF-8 -v $(pwd)/build/linux-x86_64-server-release/images/jdk:/opt/jdk:z -v $(pwd)/test-class:/classes:z fedora:42 /opt/jdk/bin/java -cp /classes Test
java.vm.vendor=Foo bar öÜß
$ cat test-class/Test.java
void main() {
IO.println("java.vm.vendor=" + System.getProperty("java.vm.vendor"));
}
$ podman run --rm -ti -v $(pwd)/build/linux-x86_64-server-release/images/jdk:/opt/jdk:z -v $(pwd)/test-class:/classes:z fedora:42 /opt/jdk/bin/java -cp /classes Test
java.vm.vendor=Foo bar ??????
The reason for this is that the container uses the POSIX locale which amounts to an US-ASCII encoder being used when retrieving the string while the build embeds the vendor string in UTF-8 (in gensrc/java.base/java/lang/VersionProps.java). A mismatch.
Work-around: Set -e LANG=C.UTF.8 when running the container:
$ podman run --rm -ti -e LANG=C.UTF-8 -v $(pwd)/build/linux-x86_64-server-release/images/jdk:/opt/jdk:z -v $(pwd)/test-class:/classes:z fedora:42 /opt/jdk/bin/java -cp /classes Test
java.vm.vendor=Foo bar öÜß
- relates to
-
JDK-8241678 Remove PerfData sampling via StatSampler
-
- Resolved
-