zdharma-continuum / zinit

🌻 Flexible and fast ZSH plugin manager
MIT License
2.89k stars 124 forks source link

[bug]: incorrect binaries downloaded from gh-r on an ARM EC2 #431

Closed fredcallaway closed 1 year ago

fredcallaway commented 1 year ago

What happened?

zinit is not grabbing the correct architecture from github releases on an ARM EC2 instance.

Steps to reproduce

❯ echo $CPUTYPE
aarch64

❯ zinit from"gh-r" for sbin"fzf" @junegunn/fzf

Downloading junegunn/fzf…
(Requesting `fzf-0.35.1-linux_amd64.tar.gz'…)

Relevant output

No response

Screenshots and recordings

No response

Operating System & Version

OS: linux-gnu | Vendor: unknown | Machine: aarch64 | CPU: arm64 | Processor: aarch64 | Hardware: aarch64

Zsh version

zsh 5.8.1 (aarch64-unknown-linux-gnu)

Terminal emulator

iTerm screen-256color

If using WSL on Windows, which version of WSL

No response

Additional context

No response

Code of Conduct

vladdoster commented 1 year ago

@fredcallaway -- Thanks for reporting this bug! This is a gap in our unit tests currently due to no ARM option for Github action runners.

Will get fixed ASAP.

fredcallaway commented 1 year ago

Checking in on this. Is there anything I could do to help?

vladdoster commented 1 year ago

@fredcallaway You can test the fix :^)

git --work-tree=$ZINIT[BIN_DIR] fetch --all;
git --work-tree=$ZINIT[BIN_DIR] checkout refactor/zinit-install;
zi delete junegunn/fzf --yes;
zi as'null' from'gh-r' sbin for @junegunn/fzf;

Test system:

$ uname -a
Linux 91dc4480ffaf 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 GNU/Linux

Result

Screenshot 2022-12-22 at 18 25 27
fredcallaway commented 1 year ago

Hmm... on my EC2, I seem to get a darwin_arm binary. (Also I had to replace --work-tree with -C)

image
❯ uname -a
Linux recserver.localdomain 5.15.0-1026-aws #30-Ubuntu SMP Wed Nov 23 17:01:09 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

❯ git -C $ZINIT[BIN_DIR] status
On branch refactor/zinit-install
Your branch is up to date with 'origin/refactor/zinit-install'.

Perhaps it has to do with the extra aarch64s in the uname output?

fredcallaway commented 1 year ago

A possible workaround to deal with parsing difficulties would be to have an optional environment variable specifying the architecture (which would be set in a machine-specific rc file).

vladdoster commented 1 year ago

@fredcallaway,

Sorry about that. I had pushed breaking changes. Could you try again?

fredcallaway commented 1 year ago

OK that did it! Many thanks for your work maintaining this wonderful project.

By the way, I found that I had to run zi/zinit in a new shell to get the updated version from the pull.

zsh -ic "zi as'null' from'gh-r' sbin for @junegunn/fzf;"
vladdoster commented 1 year ago

@fredcallaway I'm going to reopen this until the PR is merged.

vladdoster commented 1 year ago
Screenshot 2023-01-07 at 22 46 35