On Mon, 11 Mar 2024 17:46:14 GMT, Chad Rakoczy <d...@openjdk.org> wrote:

> Fix for [8325621](https://bugs.openjdk.org/browse/JDK-8325621)
> 
> Updates jspawnhelper to check that JDK version and jspawnhelper version are 
> the same. Updates test to include check for version. Also tested manually by 
> replacing jspawnhelper with incorrect version to confirm that check works.

If you really want to require an exact match for jspawnhelper, then these 4 
numbers aren't necessarily enough, but a rather arbitrarily chosen 
approximation. We have 3 more potential dotted numbers (extra1-3) as well as 
the OPT string that could potentially describe a different build. 

I saw someone argued for using separated version variables for comparison in an 
issue comment, but I'm not sure I agree. We have a pretty well defined version 
string so comparing that would be much easier, and basically guaranteed to 
accomplish what I understand to be the goal of this change. Comparing any 
subset of other version variables will always just be an approximation, and 
while an approximation may be fine, it's difficult to predict exactly how that 
will play out in the future.

src/java.base/unix/native/jspawnhelper/jspawnhelper.c line 172:

> 170:         // Check that JDK version and jspawnhelper version are the same
> 171:         if (jdk_feature != VERSION_FEATURE || jdk_interim != 
> VERSION_INTERIM || jdk_update != VERSION_UPDATE || jdk_patch != 
> VERSION_PATCH) {
> 172:             fprintf(stderr, "Expected jspawnhelper for Java %d.%d.%d+%d, 
> ", jdk_feature, jdk_interim, jdk_update, jdk_patch);

This isn't correct. All of feature, interim, update and patch are always dot 
separated. The `+` is the separator for the build number.

-------------

PR Review: https://git.openjdk.org/jdk/pull/18204#pullrequestreview-1928706835
PR Review Comment: https://git.openjdk.org/jdk/pull/18204#discussion_r1520217129

Reply via email to