Skip to content

8359830: Incorrect os.version reported on macOS Tahoe 26 (Beta) #25865

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jaikiran
Copy link
Member

@jaikiran jaikiran commented Jun 18, 2025

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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8359830: Incorrect os.version reported on macOS Tahoe 26 (Beta) (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25865/head:pull/25865
$ git checkout pull/25865

Update a local copy of the PR:
$ git checkout pull/25865
$ git pull https://git.openjdk.org/jdk.git pull/25865/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25865

View PR using the GUI difftool:
$ git pr show -t 25865

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25865.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 18, 2025

👋 Welcome back jpai! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jun 18, 2025

@jaikiran 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:

8359830: Incorrect os.version reported on macOS Tahoe 26 (Beta)

Reviewed-by: rriggs, kcr

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 11 new commits pushed to the master branch:

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 18, 2025
@openjdk
Copy link

openjdk bot commented Jun 18, 2025

@jaikiran The following label will be automatically applied to this pull request:

  • core-libs

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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jun 18, 2025
@mlbridge
Copy link

mlbridge bot commented Jun 18, 2025

Webrevs

@jaikiran
Copy link
Member Author

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.

I got access to a macOS 26 Beta and ran tier1 tests on it with this change. The tests completed fine. Only one CDS test is failing runtime/cds/DeterministicDump.java, but that doesn't look related to this change (I haven't completed analyzed that failure so far):

==============================
Test summary
==============================
   TEST                                         TOTAL  PASS  FAIL ERROR  SKIP   
>> jtreg:test/hotspot/jtreg:tier1                3022  2574     1     0   447 <<
   jtreg:test/jdk:tier1                          2525  2469     0     0    56   
   jtreg:test/langtools:tier1                    4651  4642     0     0     9   
   jtreg:test/jaxp:tier1                            0     0     0     0     0   
   jtreg:test/lib-test:tier1                       37    37     0     0     0   
==============================


Copy link
Contributor

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

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

Looks good. Give it a day or so for others to review.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 18, 2025
Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

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

LGTM

I tested this on macOS 26. Without this patch os.version is set to 16; with this patch, it is correctly set to 26.

I left one possible suggestion, if you want to consider it.

const char* envVal = getenv("SYSTEM_VERSION_COMPAT");
const bool versionCompatEnabled = envVal != NULL && strncmp(envVal, "1", 1) == 0;
const bool requiresSpecialHandling = ((long) osVer.majorVersion == 10 && (long) osVer.minorVersion >= 16)
|| ((long) osVer.majorVersion == 16 && (long) osVer.minorVersion >= 0);
Copy link
Member

Choose a reason for hiding this comment

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

Since we know Apple jumped from 15 --> 26, would it be more future-proof to change this test to something like this?

    osVer.majorVersion >= 16 && osVer.majorVersion < 26 

This would allow us to work when macOS 27 comes out, in case it reports itself as "17.0" if we don't update the version of Xcode before then.

I can also see the argument for leaving it as you have done. And my guess is that Apple will report macOS 27 as 27 regardless, so this probably doesn't matter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hello Kevin,

I can also see the argument for leaving it as you have done.

I gave your suggestion some thought. I think it would be simpler (and less confusing) to leave that check in the current form and update it as and when needed depending on whether macOS does report future versions as two different values.

@AlanBateman
Copy link
Contributor

Are there changes for os_bsd.cpp too?

@jaikiran
Copy link
Member Author

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.

@jaikiran
Copy link
Member Author

jaikiran commented Jun 23, 2025

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.

It looks like an existing test test/hotspot/jtreg/runtime/ErrorHandling/PrintVMInfoAtExitTest.java might need an update to include a check for the OS version reported in the output.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
core-libs core-libs-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants