OpenSearch icon indicating copy to clipboard operation
OpenSearch copied to clipboard

[BUG]Wrong OS and Chip versions are being displayed.

Open rohan8538 opened this issue 3 years ago • 2 comments

Describe the bug This executes successfully "./gradlew: build-tools:spotlessApply". But the OS version and the chip manufacturer displayed is wrong. I am running a win 10 pc with Inter i5 8th gen Chip(64 bit). Manufacturer - Acer (Model - Predator Helios 300).

To Reproduce Steps to reproduce the behavior:

  1. just run ./gradlew: build-tools:spotlessApply
  2. Scroll down.
  3. Verify with your System specs.

Expected behavior It should display the correct System OS version and the processor chip.

Plugins None.

Screenshots image

Host/Environment (please complete the following information):

  • OS: win 11
  • Version Home

Additional context

rohan8538 avatar Sep 16 '22 12:09 rohan8538

Hi, I don't think this is a bug for OpenSearch, because the displayed value is obtained by the Java Platform (JDK) installed in your system, and depends on the JDK version.

See the below code and link for reference: https://github.com/opensearch-project/OpenSearch/blob/72e680154428c5c705f68e4d8f72d408b8d01890/buildSrc/src/main/java/org/opensearch/gradle/info/GlobalBuildInfoPlugin.java#L158-L160

https://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html

About OS version: Older JDK version can't recognize the newly released Windows 11, and the bug is fixed in newer JDK version, see https://bugs.openjdk.org/browse/JDK-8274840. Please update the JDK in your system if you want Windows 11 to be detected correctly. (Here is an example that older JDK version can't recognize newer Windows version: https://stackoverflow.com/a/31110542/11408564. Especially Windows 11 and Windows 10 share the same version number "10.0": https://www.gaijin.at/en/infos/windows-version-numbers https://docs.microsoft.com/en-us/windows/win32/sysinfo/operating-system-version)

About CPU architecture: The name in the () of the "OS Info" stands for the the CPU architecture name, but not the CPU model name, so "amd64" is the correct value for your CPU. Although it's hard to find all possible value of the detected CPU architecture value of JDK (https://stackoverflow.com/questions/10846105/all-possible-values-os-arch-in-32bit-jre-and-in-64bit-jre), I think it's similar with what Gradle detects: https://docs.gradle.org/7.5.1/javadoc/org/gradle/nativeplatform/platform/Architecture.html.

tlfeng avatar Sep 16 '22 17:09 tlfeng

Although it's hard to find all possible value of the detected CPU architecture value of JDK

They're in this macro (focused on where the JDK produces amd64): https://github.com/openjdk/jdk/blob/bddef7151849a213926ffdd86a7e228db66606b1/make/autoconf/platform.m4#L475-L484

dbwiddis avatar Sep 16 '22 21:09 dbwiddis

Hey @rohan8538 I'm going to close this issue since I think the information above explains where the information comes from (the JVM).

Older JDKs were unaware of Win 11 (which is distinguished by a build number comparison, the "major" version is still 10) so updating your JDK should fix the problem.

dbwiddis avatar Jan 25 '23 01:01 dbwiddis