Skip to content

fix(launcher): correct parsing of java release files under Bash/msys2 etc on Windows#9127

Merged
headius merged 3 commits intojruby:masterfrom
chadlwilson:fix-jrubysh-with-CRs
Dec 10, 2025
Merged

fix(launcher): correct parsing of java release files under Bash/msys2 etc on Windows#9127
headius merged 3 commits intojruby:masterfrom
chadlwilson:fix-jrubysh-with-CRs

Conversation

@chadlwilson
Copy link
Contributor

@chadlwilson chadlwilson commented Dec 9, 2025

The Eclipse Temurin files have CRLFs on Windows which breaks the parsing and unquoting here.

Notes

  • After this change any other trailing whitespace still breaks the parsing (at least with bash); this only trims a single trailing CR.
  • Parsing .jruby.java_opts in the non-module JVM case seems to work fine as-is, because it splits on whitespace anyway (which also means it doesn't work for any args with intentional whitespace in them anyway; quoted or unquoted in the file); but I aligned the IFS= to isolate from the environment and do things consistently anyway.
  • Made some minor tweaks to the shellcheck rules to be a bit more conservative and make IntelliJ IDEA's integration happen
  • Logged the parsed major version and minimum versions to assist debugging with --environment in future.
  • Corrected typo to use JAVA_RUNTIME_VERSION correctly as intended per conversation in fix(launcher): correct parsing of java release files under Bash/msys2 etc on Windows #9127 (comment)

Example 1 (Temurin x64 on Windows, with CRLF)

IMPLEMENTOR="Eclipse Adoptium"
IMPLEMENTOR_VERSION="Temurin-21.0.9+10"
JAVA_RUNTIME_VERSION="21.0.9+10-LTS"
JAVA_VERSION="21.0.9"
JAVA_VERSION_DATE="2025-10-21"
LIBC="default"
MODULES="java.base java.compiler java.datatransfer java.xml java.prefs java.desktop java.instrument java.logging java.management java.security.sasl java.naming java.rmi java.management.rmi java.net.http java.scripting java.security.jgss java.transaction.xa java.sql java.sql.rowset java.xml.crypto java.se java.smartcardio jdk.accessibility jdk.internal.jvmstat jdk.attach jdk.charsets jdk.internal.opt jdk.zipfs jdk.compiler jdk.crypto.ec jdk.crypto.cryptoki jdk.crypto.mscapi jdk.dynalink jdk.internal.ed jdk.editpad jdk.hotspot.agent jdk.httpserver jdk.incubator.vector jdk.internal.le jdk.internal.vm.ci jdk.internal.vm.compiler jdk.internal.vm.compiler.management jdk.jartool jdk.javadoc jdk.jcmd jdk.management jdk.management.agent jdk.jconsole jdk.jdeps jdk.jdwp.agent jdk.jdi jdk.jfr jdk.jlink jdk.jpackage jdk.jshell jdk.jsobject jdk.jstatd jdk.localedata jdk.management.jfr jdk.naming.dns jdk.naming.rmi jdk.net jdk.nio.mapmode jdk.random jdk.sctp jdk.security.auth jdk.security.jgss jdk.unsupported jdk.unsupported.desktop jdk.xml.dom"
OS_ARCH="x86_64"
OS_NAME="Windows"
SOURCE=".:git:759062135b07"
BUILD_SOURCE="git:839fa0b45d809157cffd3dc8515aad262a4a1776"
BUILD_SOURCE_REPO="https://github.com/adoptium/temurin-build.git"
SOURCE_REPO="https://github.com/adoptium/jdk21u.git"
FULL_VERSION="21.0.9+10-LTS"
SEMANTIC_VERSION="21.0.9+10"
BUILD_INFO="OS: Windows Server 2022 Version: 10.0"
JVM_VARIANT="Hotspot"
JVM_VERSION="21.0.9+10-LTS"
IMAGE_TYPE="JDK"

Example 2 (Microsoft aarch64 on Windows, with CRLF)

IMPLEMENTOR="Microsoft"
IMPLEMENTOR_VERSION="Microsoft-11952137"
JAVA_RUNTIME_VERSION="21.0.8+9-LTS"
JAVA_VERSION="21.0.8"
JAVA_VERSION_DATE="2025-07-15"
LIBC="default"
MODULES="java.base java.compiler java.datatransfer java.xml java.prefs java.desktop java.instrument java.logging java.management java.security.sasl java.naming java.rmi java.management.rmi java.net.http java.scripting java.security.jgss java.transaction.xa java.sql java.sql.rowset java.xml.crypto java.se java.smartcardio jdk.accessibility jdk.internal.jvmstat jdk.attach jdk.charsets jdk.internal.opt jdk.zipfs jdk.compiler jdk.crypto.ec jdk.crypto.cryptoki jdk.crypto.mscapi jdk.dynalink jdk.internal.ed jdk.editpad jdk.hotspot.agent jdk.httpserver jdk.incubator.vector jdk.internal.le jdk.internal.vm.ci jdk.internal.vm.compiler jdk.internal.vm.compiler.management jdk.jartool jdk.javadoc jdk.jcmd jdk.management jdk.management.agent jdk.jconsole jdk.jdeps jdk.jdwp.agent jdk.jdi jdk.jfr jdk.jlink jdk.jpackage jdk.jshell jdk.jsobject jdk.jstatd jdk.localedata jdk.management.jfr jdk.naming.dns jdk.naming.rmi jdk.net jdk.nio.mapmode jdk.random jdk.sctp jdk.security.auth jdk.security.jgss jdk.unsupported jdk.unsupported.desktop jdk.xml.dom"
OS_ARCH="aarch64"
OS_NAME="Windows"
SOURCE=".:git:bd8efd5c847d"

@headius
Copy link
Member

headius commented Dec 9, 2025

Pinging @mrnoname1000 to help review this and offer suggestions!

chadlwilson added a commit to chadlwilson/jruby that referenced this pull request Dec 10, 2025
…suffixes

As discussed in jruby#9127 (comment) this isn't perfect; however gets closer to the internal compatibility matching the JVM seems to do when loading JSAs at https://github.com/openjdk/jdk21u/blob/3c0530fd5f9615941144d8ac89786ce699027b51/src/hotspot/share/cds/filemap.cpp#L1341-L1349 (JDK 21)

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
@chadlwilson chadlwilson force-pushed the fix-jrubysh-with-CRs branch 2 times, most recently from 4aaaadd to 8bf8958 Compare December 10, 2025 06:01
…A suffixes

As discussed in jruby#9127 (comment) this isn't perfect; however gets closer to the internal compatibility matching the JVM seems to do when loading JSAs at https://github.com/openjdk/jdk21u/blob/3c0530fd5f9615941144d8ac89786ce699027b51/src/hotspot/share/cds/filemap.cpp#L1341-L1349 (JDK 21)

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
shellcheck treats the shell=dash designation as indication to only care about dash rules; however IntelliJ idea will still highlight it as an issue. We are probably better to only suppress the relevant rule.

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
…release metadata

Windows Temurin builds (for example) use CRLF in their `release` file; which breaks unquoting and thus the rest of the script.

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
Copy link
Member

@headius headius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@headius
Copy link
Member

headius commented Dec 10, 2025

Proceeding with merge! Thank you!

@headius headius merged commit b11505b into jruby:master Dec 10, 2025
77 checks passed
@chadlwilson chadlwilson deleted the fix-jrubysh-with-CRs branch December 10, 2025 08:32
chadlwilson added a commit to chadlwilson/jruby that referenced this pull request Dec 10, 2025
…A suffixes

As discussed in jruby#9127 (comment) this isn't perfect; however gets closer to the internal compatibility matching the JVM seems to do when loading JSAs at https://github.com/openjdk/jdk21u/blob/3c0530fd5f9615941144d8ac89786ce699027b51/src/hotspot/share/cds/filemap.cpp#L1341-L1349 (JDK 21)

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
(cherry picked from commit 250080a)
@enebo enebo added this to the JRuby 10.0.3.0 milestone Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected jruby.sh error messages on Windows

4 participants