New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8253702: BigSur version number reported as 10.16, should be 11.nn #2530
Conversation
|
@RogerRiggs The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
} else { | ||
nsVerStr = [NSString stringWithFormat:@"%ld.%ld.%ld", | ||
(long)osVer.majorVersion, (long)osVer.minorVersion, (long)osVer.patchVersion]; | ||
// Copy out the char* if running on version other than pre-10.16 Mac OS (10.16 == 11.x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the comment backwards from what the test does? I would think it should be "if running on version other than 10.16 Mac OS ...". Or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinrushforth I think you are correct. This is actually mea culpa I think as I had provided in a Slack thread a failed attempt at a patch for this which contained this comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the words "other than" are too subtle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a double negative, unless I'm reading it incorrectly: "other than pre-10.16" I interpret as "not pre-10.16" or "10.16".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Copy out the char* if running on version 10.x[.y], where x < 16
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will also do it if running on 11.x[.y]
(once Xcode is upgraded), right?
} | ||
// Copy out the char* | ||
osVersionCStr = strdup([nsVerStr UTF8String]); | ||
} else if (getenv("SYSTEM_VERSION_COMPAT") == NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If version is 10.16 and SYSTEM_VERSION_COMPAT
is set, you will fall through to the pre-10.9 Mac OS code fallback. Just checking to see if that's what you intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, it seems to work OK using the legacy fallback path (reports 10.16 if I set SYSTEM_VERSION_COMPAT=1
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same version string is available from both APIs, reading from the SystemVersion.plist is a bit slower.
It would be clearer to move the checking of SYSTEM_VERSION_COMPAT to the first test (line:252)
so the version info does not need to be read from the files.
I tested this, and get the following behavior on macOS 11.0.1 with a JDK compiled with Xcode 11.3.1 and your patch: SYSTEM_VERSION_COMPAT not set : 11.0 So the fallback path reports what could be considered a more accurate version, at least on my laptop. Since I'm not sure what is expected, you can decide what to do with this information. |
@RogerRiggs This change now passes all automated pre-integration checks. 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 22 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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
/integrate |
@RogerRiggs Since your change was applied there have been 22 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 6675775. |
Thanks for the fix! This is probably the best we can get without spawning an external process to e.g. call sw_vers to get the actual, non-compat version number. Unfortunately, the test java/lang/System/OsVersionTest.java will still fail on systems where the MacOS version has a patch number (>1), e.g. the current MacOS 11.2.1 - in line with Kevin's report about the behavior on an 11.0.1 system. I will open another ticket and propose a test update that relaxes the check in the test a little... |
With macOS 11.6 this fix no longer works. @sormuras will create a proper bug report. |
Hi Marc, not necessary, it was already reported & fixed: https://bugs.openjdk.java.net/browse/JDK-8269850 Cheers |
Thanks! I searched the bug tracker but couldn't find it. Will that be backported to JDK 11 and/or 17? |
Yup: For OpenJDK 11u I hope to get it into the October Update. Can't speak for 17u as this is maintained by Oracle. Maybe @sormuras can help here :) |
On Mac Os X, the OSVersionTest detected a difference in the version number reported in the os.version property
and the version number provided by
sw_vers -productVersion
.When the java runtime is built with XCode 11.3, the os.version is reported as 10.16
though the current version numbering is 11.nnn.
The workaround is to derive the os.version number from the ProductBuildVersion.
When the toolchain is updated to XCode 12.nnn it can be removed.
The workaround is enabled only when the environment variable SYSTEM_VERSION_COMPAT is unset.
When the SYSTEM_VERSION_COMPAT is set in the environment the version number is reported as reported by Mac OS X.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2530/head:pull/2530
$ git checkout pull/2530