RFR: 8359830: Incorrect os.version reported on macOS Tahoe 26 (Beta)
Jaikiran Pai
jpai at openjdk.org
Mon Jun 23 08:09:28 UTC 2025
On Wed, 18 Jun 2025 06:01:43 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
> Can I please get a review of this change which proposes to address the issue noted in https://bugs.openjdk.org/browse/JDK-8359830?
>
> macOS operating system's newer version 26 (currently in Beta) is reported as a 16 by older versions of XCode. JDK internally uses the `NSProcessInfo` and `NSOperatingSystemVersion` APIs to identify the macOS version and set the `os.version` system property to that value. The current recommended version to build the JDK on macOS is XCode 15.4. The `NSOperatingSystemVersion` API on that version of XCode reports macOS version as 16 instead of 26.
>
> The commit in this PR updates the JDK code to handle this mismatch and set the `os.version` appropriately to 26. This fix is similar to what we did with macOS BigSur when the macOS version 10.16 was meant to mean 11 https://bugs.openjdk.org/browse/JDK-8253702.
>
> The existing `OsVersionTest` has been updated for some trivial clean up. Existing tests in tier1, tier2 and tier3 continue to pass with this change. If anyone has access to a macOS 26 Beta, I request them to build this change and run `tier1` tests to help verify that there aren't any failures.
Hello Alan,
> Are there changes for os_bsd.cpp too?
That's a good catch. I did not know that we have `os::get_summary_os_info` in that file which too deals with OS name and version. The native functions used in that implementation are `sysctl()` calls. I experimented on a macOS 26 (Beta) instance and those functions too report the "wrong" version (16) when the JDK is built using XCode 15.4. So this code needs to be addressed too.
This `os::get_summary_os_info` gets used only through `os::print_summary_info` (in `os.cpp`), which gets called for VM crash info reporting as well as `java -XX:+UnlockDiagnosticVMOptions -XX:+PrintVMInfoAtExit ...`. I think we are missing a test for this which might explain why tier1, tier2, tier3 testing of this current change didn't notice that this area too needs a change. I'll update this PR to include this additional code change and introduce a new regression test to catch this issue.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25865#issuecomment-2995383253
More information about the core-libs-dev
mailing list