Skip to content
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

fix: Wrong bitness information #6485

Merged
merged 5 commits into from
Mar 24, 2024
Merged

Conversation

canerakdas
Copy link
Member

@canerakdas canerakdas commented Mar 19, 2024

Description

If we cannot get the user's bitness information from the userAgent if getHighEntropyValues is not supported, the default is x86.

We act as if we are using the architecture, but since the x86 version is not officially distributed for Linux and Mac, users are directed to the wrong links.

This PR aims to create an alternative source to getHighEntropyValues by adding more to the conditions we check in userAgent.

Also, should we do something in the UI for versions that do not have an x86 version? (Maybe disabling the button?) cc @nodejs/nodejs-website

Validation

It would be better to test it on as many operating systems as possible in preview 👀

Related Issues

Fixes #6360

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run npx turbo format to ensure the code follows the style guide.
  • I have run npx turbo test to check if all tests are passing.
  • I have run npx turbo build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@canerakdas canerakdas requested a review from a team as a code owner March 19, 2024 21:29
Copy link

vercel bot commented Mar 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Mar 23, 2024 10:12am

Copy link
Contributor

github-actions bot commented Mar 19, 2024

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 99 🟢 90 🟢 100 🟢 91 🔗
/en/about 🟢 100 🟢 91 🟢 100 🟢 91 🔗
/en/about/previous-releases 🟢 99 🟢 90 🟢 100 🟢 92 🔗
/en/download 🟢 99 🟠 89 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 90 🟢 100 🟢 92 🔗

@ovflowd
Copy link
Member

ovflowd commented Mar 19, 2024

Also, should we do something in the UI for versions that do not have an x86 version? (Maybe disabling the button?) cc @nodejs/nodejs-website

I thought we already disable x86 when x64 is not supported. But maybe it's because the initial state contains x86?

Copy link
Contributor

github-actions bot commented Mar 19, 2024

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 84%
80.1% (451/563) 79.44% (143/180) 71.17% (79/111)

Unit Test Report

Tests Skipped Failures Errors Time
90 0 💤 0 ❌ 0 🔥 4.444s ⏱️

@canerakdas
Copy link
Member Author

In this PR, we prevent x64 Linux users from trying to download the x86 version, but two more issues come to my mind cc @nodejs/nodejs-website

  1. What should we do if there is no official x86 support for a user with x86 architecture?
  2. Arm or Apple silicon users who do not use the x64 platform and whose browser does not support getHighEntropyValues. There seems to be no problem since it is the only option on macOS. But I feel like we haven't been able to orient properly on Windows and Linux and need to do some development similar to what we did in this PR to figure out the architecture.

@canerakdas
Copy link
Member Author

I thought we already disable x86 when x64 is not supported. But maybe it's because the initial state contains x86?

I couldn't get the question 🙈

@ovflowd
Copy link
Member

ovflowd commented Mar 22, 2024

I thought we already disable x86 when x64 is not supported. But maybe it's because the initial state contains x86?

I couldn't get the question 🙈

If the OS itself doesn't support x86 variants we should already disable prevent the state from reaching that. At least on the UI-side

The current bug is more related to the actual link generation

@ovflowd
Copy link
Member

ovflowd commented Mar 22, 2024

Arm or Apple silicon users who do not use the x64 platform and whose browser does not support getHighEntropyValues. There seems to be no problem since it is the only option on macOS. But I feel like we haven't been able to orient properly on Windows and Linux and need to do some development similar to what we did in this PR to figure out the architecture.

There's no much we can do. There's so much we can do with automated OS detection. I hope eventually Firefox supports these APIs

Copy link
Member

@sxa sxa left a comment

Choose a reason for hiding this comment

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

I hit this today too. Is the ; after x64 intentional?

Other than that, I definitely approve of this being fixed - and it works for me (TM) - but i the ; is an error then it should be fixed first.

@canerakdas
Copy link
Member Author

I hit this today too. Is the ; after x64 intentional?

This is a bit of an edge-case scenario, some examples contain x64 in the user agent but whose architecture is not x64

For example, the user agent below;
Links (0.99; Darwin 10.7.0 i386; 236x64)

Architecture is i386 but it contains x64

As far as I understand from looking at this list, the x64; control is Firefox-based, but it is an added condition for what we cannot catch from other controls

@canerakdas
Copy link
Member Author

canerakdas commented Mar 23, 2024

The current bug is more related to the actual link generation

There seemed to be no problem with the current version of link generation 🤔

To make the code more understandable for everyone, I added comments and updated the default values for OS that do not support x86

@canerakdas canerakdas added the github_actions:pull-request Trigger Pull Request Checks label Mar 23, 2024
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Mar 23, 2024
@ovflowd ovflowd added this pull request to the merge queue Mar 24, 2024
Merged via the queue into nodejs:main with commit f7c6613 Mar 24, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NodeJS LTS Linux download link dead
8 participants