-
Bug
-
Resolution: Fixed
-
P3
-
11, 17, 18
-
b07
-
b25
-
x86_64
-
linux_debian_3.0
ADDITIONAL SYSTEM INFORMATION :
Debian 12 testing/bookworm amd64
A DESCRIPTION OF THE PROBLEM :
Java app fails to start if LC_ALL is set to locale whose charset is not in the list known by java.nio.Charset
This issue manifested during reproducibility test of Kodi on Debian bookworm using reprotest. For those not familiar with reproducible builds, reprotest performs first build of Debian or RPM package with fixed set of environment, reported kernel (uname -m), build path, locale, timezone and local time etc then does the second build of the same package with totally different (varied) ingredients.
Locale on the experiment build is chosen of: fr_CH.UTF-8, kk_KZ.RK1048 es_ES.ISO-8859-1, zh_CN.GB1232
While es_ES.ISO-8859-1 and fr_CH.UTF-8 have charsets known to java.nio.Charset (Latin and UTF-8, respectively),
Kazakh locale (kk_KZ.RK1048) charset is not known.
The easiest Dockerfile reproducer shows the stacktrace running "java -version":
# java -version
Error occurred during initialization of VM
java.lang.IllegalArgumentException: Null charset name
at java.nio.charset.Charset.lookup(java.base/Charset.java:455)
at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:608)
at java.lang.StringCoding.decode(java.base/StringCoding.java:316)
at java.lang.String.<init>(java.base/String.java:592)
at java.lang.String.<init>(java.base/String.java:614)
at java.lang.System.initProperties(java.base/Native Method)
at java.lang.System.initPhase1(java.base/System.java:1948)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Build the following Dockerfile with JDK 18 from official Oracle downloads using "docker build -f Dockerfile".
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Docker image must be created without errors
ACTUAL -
Java refuses to start, halting the reproducer Dockerfile build.
---------- BEGIN SOURCE ----------
#FROM docker.io/library/debian:bookworm
FROM debian:bookworm
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -yq locales wget && \
sed -i '/# kk_KZ.RK1048/s/^# //' /etc/locale.gen && \
echo 'kk_KZ.RK1048' > /etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \
wget -qO /tmp/openjdk.tar.gz https://download.java.net/java/early_access/jdk18/18/GPL/openjdk-18-ea+18_linux-x64_bin.tar.gz && \
cd /tmp && \
tar xf openjdk.tar.gz && \
LC_ALL=kk_KZ.RK1048 /tmp/jdk-18/bin/java -version
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Setting locale to C or POSIX or C.UTF-8 fixes the issue
FREQUENCY : always
Debian 12 testing/bookworm amd64
A DESCRIPTION OF THE PROBLEM :
Java app fails to start if LC_ALL is set to locale whose charset is not in the list known by java.nio.Charset
This issue manifested during reproducibility test of Kodi on Debian bookworm using reprotest. For those not familiar with reproducible builds, reprotest performs first build of Debian or RPM package with fixed set of environment, reported kernel (uname -m), build path, locale, timezone and local time etc then does the second build of the same package with totally different (varied) ingredients.
Locale on the experiment build is chosen of: fr_CH.UTF-8, kk_KZ.RK1048 es_ES.ISO-8859-1, zh_CN.GB1232
While es_ES.ISO-8859-1 and fr_CH.UTF-8 have charsets known to java.nio.Charset (Latin and UTF-8, respectively),
Kazakh locale (kk_KZ.RK1048) charset is not known.
The easiest Dockerfile reproducer shows the stacktrace running "java -version":
# java -version
Error occurred during initialization of VM
java.lang.IllegalArgumentException: Null charset name
at java.nio.charset.Charset.lookup(java.base/Charset.java:455)
at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:608)
at java.lang.StringCoding.decode(java.base/StringCoding.java:316)
at java.lang.String.<init>(java.base/String.java:592)
at java.lang.String.<init>(java.base/String.java:614)
at java.lang.System.initProperties(java.base/Native Method)
at java.lang.System.initPhase1(java.base/System.java:1948)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Build the following Dockerfile with JDK 18 from official Oracle downloads using "docker build -f Dockerfile".
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Docker image must be created without errors
ACTUAL -
Java refuses to start, halting the reproducer Dockerfile build.
---------- BEGIN SOURCE ----------
#FROM docker.io/library/debian:bookworm
FROM debian:bookworm
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -yq locales wget && \
sed -i '/# kk_KZ.RK1048/s/^# //' /etc/locale.gen && \
echo 'kk_KZ.RK1048' > /etc/default/locale && \
dpkg-reconfigure --frontend=noninteractive locales && \
wget -qO /tmp/openjdk.tar.gz https://download.java.net/java/early_access/jdk18/18/GPL/openjdk-18-ea+18_linux-x64_bin.tar.gz && \
cd /tmp && \
tar xf openjdk.tar.gz && \
LC_ALL=kk_KZ.RK1048 /tmp/jdk-18/bin/java -version
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Setting locale to C or POSIX or C.UTF-8 fixes the issue
FREQUENCY : always