Skip to content

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

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

Closed
wants to merge 4 commits into 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, lancea, 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 14 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.

@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.

@jaikiran
Copy link
Member Author

Hello Alan, I've been pursuing this further and there's a way to address this issue in os_bsd.cpp#get_summary_os_info(). The ultimate place where we get the correct version is the plist files that are referenced in this PR. plist files are XML files and to be able to read those semantically, either a XML parser is necessary or we can use the Objective-C APIs that are provided by macOS in the Foundation framework (the same ones that we currently use in the java_props_macosx.c). I've been experimenting with using these Objective-C APIs in this C++ code of hotspot, but have been running into build issues. I am currently discussing those with people familiar with this area and plan to continue pursuing it further. However, in the meantime, if it's OK then I would like to go ahead and integrate the current state of this PR into mainline (and have it backported), so that it gets the necessary testing time both on macOS 26 Beta and other versions. The few places where this misreporting of macOS version in os_bsd.cpp is going to impact is the VM error reporting (in hs_err files for example) and the output of the newly introduced -XX:+PrintJVMInfoAtExit option. So I think we can address this issue separately (I'll create a follow up issue to track that work). Do you think it's OK to go ahead with this integration?

@jaikiran
Copy link
Member Author

I've been experimenting with using these Objective-C APIs in this C++ code of hotspot, but have been running into build issues. I am currently discussing those with people familiar with this area and plan to continue pursuing it further.

For those who are curious, the work in progress (untested) changes look like this 0d7f593

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jun 25, 2025
@jaikiran
Copy link
Member Author

Do you think it's OK to go ahead with this integration?

I spoke to Alan about this and Alan says it's OK to do the os_bsd.cpp changes as a separate task. Alan also suggested that the long lines introduced in this PR could be shortened in length. I've updated the PR to address that. No other code changes. I will trigger a tier1, tier2 and tier3 testing with this change.

@jaikiran
Copy link
Member Author

tier1, tier2 and tier3 testing in our CI with this change and tier1 testing on macOS 26 Beta has completed without any related issues. I'll need a re-review please to go ahead with the integration.

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

Thank you all for the reviews and inputs on this one.

@jaikiran
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 26, 2025

Going to push as commit 8df6b2c.
Since your change was applied there have been 14 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 26, 2025
@openjdk openjdk bot closed this Jun 26, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jun 26, 2025
@openjdk
Copy link

openjdk bot commented Jun 26, 2025

@jaikiran Pushed as commit 8df6b2c.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@jaikiran jaikiran deleted the 8359830 branch June 26, 2025 13:37
@jaikiran
Copy link
Member Author

/backport :jdk25

@openjdk
Copy link

openjdk bot commented Jun 26, 2025

@jaikiran the backport was successfully created on the branch backport-jaikiran-8df6b2c4-jdk25 in my personal fork of openjdk/jdk. To create a pull request with this backport targeting openjdk/jdk:jdk25, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 8df6b2c4 from the openjdk/jdk repository.

The commit being backported was authored by Jaikiran Pai on 26 Jun 2025 and was reviewed by Roger Riggs, Lance Andersen and Kevin Rushforth.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk:

$ git fetch https://github.com/openjdk-bots/jdk.git backport-jaikiran-8df6b2c4-jdk25:backport-jaikiran-8df6b2c4-jdk25
$ git checkout backport-jaikiran-8df6b2c4-jdk25
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk.git backport-jaikiran-8df6b2c4-jdk25

@jaikiran
Copy link
Member Author

The few places where this misreporting of macOS version in os_bsd.cpp is going to impact is the VM error reporting (in hs_err files for example) and the output of the newly introduced -XX:+PrintJVMInfoAtExit option. So I think we can address this issue separately (I'll create a follow up issue to track that work).

I've created https://bugs.openjdk.org/browse/JDK-8360708 to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs [email protected] integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants