8347831: Re-examine version check when cross linking#28155
8347831: Re-examine version check when cross linking#28155slowhog wants to merge 10 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back henryjen! A progress list of the required criteria for merging this PR into |
|
@slowhog This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 5 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
erikj79
left a comment
There was a problem hiding this comment.
I'm not thrilled about the code duplication between Gensrc.gmk in java.base and and jdk.jlink. I think this should be extracted out into a common file in some way. Having 2 copies of the template file also seems suboptimal.
|
I'm puzzled as to why the resource has to be saved in the jdk.jlink module. When cross linking, jlink should only need to check the company/version of java.base in the current image vs. company/version of the java.base found on the module path. |
src/java.base/share/classes/jdk/internal/misc/resources/release.txt.template
Show resolved
Hide resolved
In that case, you'll need to list Magnus ( |
AlanBateman
left a comment
There was a problem hiding this comment.
The updated version is much simpler, thank you. Just a few small comments on the jlink changes.
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
erikj79
left a comment
There was a problem hiding this comment.
Build changes look good now, pending Alan's comment about location of the output file.
|
/contributor @magicus |
|
@slowhog Syntax:
User names can only be used for users in the census associated with this repository. For other contributors you need to supply the full name and email address. |
|
/contributor add @magicus |
|
@slowhog |
|
/csr |
|
@AlanBateman has indicated that a compatibility and specification (CSR) request is needed for this pull request. @slowhog please create a CSR request for issue JDK-8347831 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
jerboaa
left a comment
There was a problem hiding this comment.
I think this can be tested akin to JLinkOptionsTest by implementing a simple plugin that transforms the release.txt resource and uses --keep-packaged-modules and then attempts to perform a link on the resulting image. Similarly we could cover the case of release.txt missing by using the --exclude-resources plugin.
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink.properties
Outdated
Show resolved
Hide resolved
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| try (var r = new BufferedReader(new InputStreamReader(release.get()))) { | ||
| return Optional.of(r.readLine()); |
There was a problem hiding this comment.
As suggested on the CSR we should read the entire file, not just the first line and treat the entire content as a string in a specific encoding. While I wasn't able to get the JDK build a vendor name with new lines (due to jrt-fs.jar putting COMPANYNAME in the MANIFEST.MF) it's conceivable that some release.txt file might have more than one line.
Alternatively we need to specify that the file must not contain line breaks or unusual encodings.
There was a problem hiding this comment.
The proposal is to have a one line release signature set up by the build, briefly discussed the possibility to use a java properties file format as the current release file distributed with JDK, but then a simplified approach of one signature is preferred.
I'll update the PR once we come to conclusion with the CSR.
There was a problem hiding this comment.
It might be useful to see what breaks if a JDK were built with a newline in the vendor name, I assume other things will break.
Overall I think the changes are looking good, the main thing is that the error message is clear.
There was a problem hiding this comment.
It might be useful to see what breaks if a JDK were built with a newline in the vendor name, I assume other things will break.
Writhing the manifest entries for jrt-fs.jar break (header validation fails). Since the vendor populates to that jar file.
There was a problem hiding this comment.
The CSR is approved, and the one line signature is in the text.
And since other things break with newline in the vendor name, I assume that vendor name is also limited, so are we good with current implementation?
Are we suggesting to add error message when there is more than one line? I think current implementation is fine.
There was a problem hiding this comment.
I don't think we need to be concerned with this right now.
Maybe we should have a follow-up issue to attempt to create a test for this. However, the bigger topic of testing the cross-linking scenario isn't really something we can do in a jtreg test. Instead it is something for "special testing", like the manual tests, as it needs builds from different platforms. |
That's OK with me. Creating jtreg tests verifying that it fails if the file doesn't match/does not exist can still be done. |
|
/integrate |
|
Going to push as commit 8f0cb57.
Your commit was automatically rebased without conflicts. |
This PR include build changes from @magicus and jlink change to verify the build signature.
Tested with local builds for MacOS and Linux as below shows that cross linking with same build is working while linking with different build failed with error message.
❯ export JAVA_HOME=./build/macosx-x86_64-server-fastdebug/images/jdk-bundle/jdk-26.jdk/Contents/Home
❯ java --version
openjdk 26-internal 2026-03-17
OpenJDK Runtime Environment (fastdebug build 26-internal-adhoc.hjen.JDK-8347831)
OpenJDK 64-Bit Server VM (fastdebug build 26-internal-adhoc.hjen.JDK-8347831, mixed mode, sharing)
❯ jlink --version
26-internal
❯ jlink --module-path ./build/linux-x86_64-server-release/images/jdk/jmods --add-modules java.base --output linux
❯ jlink --add-modules java.base --output macos
❯ jlink --module-path ~/linux/jdk-25.0.1/jmods --add-modules java.base --output linux25
Error: jlink build N/A-26-internal-adhoc.hjen.JDK-8347831-2026-03-17 does not match target java.base build N/A
❯ jlink --module-path /Library/Java/JavaVirtualMachines/jdk-25.jdk/Contents/Home/jmods --add-modules java.base --output macos25
Error: jlink build N/A-26-internal-adhoc.hjen.JDK-8347831-2026-03-17 does not match target java.base build N/A
Progress
Issues
Reviewers
Contributors
<ihse@openjdk.org>Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28155/head:pull/28155$ git checkout pull/28155Update a local copy of the PR:
$ git checkout pull/28155$ git pull https://git.openjdk.org/jdk.git pull/28155/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28155View PR using the GUI difftool:
$ git pr show -t 28155Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28155.diff
Using Webrev
Link to Webrev Comment