-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[release/6.0] x64 on ARM64 fixes #59295
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/bin/sh | ||
| #!/bin/bash | ||
| # | ||
| # Licensed to the .NET Foundation under one or more agreements. | ||
| # The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
@@ -10,9 +10,21 @@ INSTALL_DESTINATION=$2 | |
| # A temporary fix for the permissions issue(s) | ||
| chmod 755 $INSTALL_DESTINATION/dotnet | ||
|
|
||
| # Add the installation directory to the system-wide paths | ||
| # But first create the directory if it doesn't exist | ||
| mkdir -p /etc/paths.d | ||
| echo $INSTALL_DESTINATION | tee /etc/paths.d/dotnet | ||
| if [ -e /etc/dotnet/install_location ]; then | ||
| # clear out any entries for this architecture if they exist | ||
| sed -i old '/^${InstallerTargetArchitecture}=/d' /etc/dotnet/install_location | ||
| else | ||
| mkdir -p /etc/dotnet | ||
| fi | ||
|
|
||
| echo ${InstallerTargetArchitecture}=$INSTALL_DESTINATION | tee -a /etc/dotnet/install_location | ||
|
|
||
| # if we're running on the native architecture | ||
| if [[ "$(uname -m)" =~ "${UnameMachineRegex}" ]]; then | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If someone is really running this installer package under Rosetta emulation, then yes I think that should be the expected behavior.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a card to our board to test this. I'm not so worried about accidentally setting path, that's easy to fix and user can change it per their intent. I am worried if somehow we can lie to the installer javascript detection, since that would put the files in the wrong place. @sfoslund https://github.com/orgs/dotnet/projects/38#card-69051611
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I believe this is against what was proposed - only setting path of dotnet for the native one. I'm ok with it either way.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If user’s intention is to “Run as x86_64 app” on arm64 host, in that case “native” is the target of emulation/virtualization and x86_64 behavior is expected. This is how other software (including Apple’s own) handle this case.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting, I just tried this out and I think I found a way to test it. If I create a terminal that runs using rosetta, then launch the installer from that ternminal I see it report @sfoslund here's the command I ran to do this: We should check the newer detection you added and see if that's avoiding this redirection.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just tried the repro with latest detection and it also sees the x64 values when run from rosetta terminal. I found at least one way to identify when this is happening: https://developer.apple.com/documentation/apple-silicon/about-the-rosetta-translation-environment.
I opened #59370 to track this.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I was considering it as a correct behavior based on how other installers (node.js, rustup and so on) operate in Rosetta2, and more generally, any emulation environments (qemu). Forcing our will against user wishes is no good, IMO.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on my quick research, it looks like we can detect if we're running in rosetta with
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @am11 perhaps you can open an issue with a scenario that you feel is blocked and we can discuss that? We're actually making the runtime aware of emulation and making it so both x64 and ARM64 can coexist. The problem is that existing installers weren't aware and would clash. We're preserving the single entrypoint, so we do have to make the installers aware of real architecture so that they can avoid clashing. This is the part we can't have lied to, since that circumvents the work. The rest of the runtime is happy to be lied to, that's what the support for this is all about. |
||
| # Add the installation directory to the system-wide paths | ||
| # But first create the directory if it doesn't exist | ||
| mkdir -p /etc/paths.d | ||
| echo $INSTALL_DESTINATION | tee /etc/paths.d/dotnet | ||
| fi | ||
|
|
||
| exit 0 | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.