axodotdev / axodotdev/cargo-dist

powershell installer picks the wrong architecture

Open
#2,086 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.1k
Forks
149
Avg merge
1d 11h
Merged PRs (30d)
32

Description

On an arm64 Windows host, running
```
> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Downloading uv 0.8.15 (x86_64-pc-windows-msvc)
```
As you can see, it picks an x86_64 release to download & install.

After some digging, it seems like this logic:
```powershell
$a = [System.Reflection.Assembly]::LoadWithPartialName("System.Runtime.InteropServices.RuntimeInformation")
$t = $a.GetType("System.Runtime.InteropServices.RuntimeInformation")
$p = $t.GetProperty("OSArchitecture")
$p.GetValue($null)
```

Returns `X64` when executed via `powershell.exe`. It returns the correct value from Powershell Core (aka `pwsh.exe`), and indeed:

```
> pwsh -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Downloading uv 0.8.15 (aarch64-pc-windows-msvc)
```

## version info:

```
> powershell -c 'echo $PSVersionTable'

Name Value
---- -----
PSVersion 5.1.26100.5074
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.26100.5074
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

```
> pwsh -c 'echo $PSVersionTable'

Name Value
---- -----
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
```

Contributor guide

Open the contributing guide

Research direction

Start with the install.ps1 entry point used by the documented PowerShell commands, and reproduce the architecture detection under Windows PowerShell 5.1 and PowerShell 7. Confirm that an ARM64 host selects the aarch64-pc-windows-msvc release instead of x86_64-pc-windows-msvc, while preserving the existing behavior on other hosts.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
release
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.