zdharma-continuum / zinit

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

[bug]: Wrong program download after update #456

Closed mmedum closed 1 year ago

mmedum commented 1 year ago

What happened?

Unsure when this started, but after an update to zinit, I am starting to see .zi::get-architecture:3: command not found: arch.

When this happened, I started to be unable to install a few program using zi ice as"command" such as ripgrep, since instead of downloading [ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz] (https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz) it now defaults to [ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz](https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz), this now result in the output zsh: exec format error: rg

Steps to reproduce

  1. Add .,zshrc file
  2. Add zi ice from"gh-r" as"command" mv"ripgrep/* -> rg" pick"rg/rg" zi light BurntSushi/ripgrep on a standard linux system
  3. run rg
  4. Output is now: zsh: exec format error: rg

Relevant output

Downloading BurntSushi/ripgrep…
.zi::get-architecture:3: command not found: arch
(Requesting `ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz'…)
####################################################################################################################### 100.0%
[ziextract] Unpacking the files from: `ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz'…
[ziextract] Successfully extracted and assigned +x chmod to the file: ripgrep-13.0.0-arm-unknown-linux-gnueabihf/rg.
renamed 'ripgrep-13.0.0-arm-unknown-linux-gnueabihf' -> 'ripgrep'
Installed 1 completions. They are stored in the $INSTALLED_COMPS array.


### Screenshots and recordings

_No response_

### Operating System & Version

OS: linux-gnu | Vendor: pc | Machine: x86_64 | CPU: x86_64 | Processor: unknown | Hardware: x86_64

### Zsh version

zsh 5.9 (x86_64-pc-linux-gnu)

### Terminal emulator

alacritty

### If using WSL on Windows, which version of WSL

None

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
vladdoster commented 1 year ago

@mmedum,

Huh, bit surprised arch is not a command on your system. What OS are you using?

I will open a fix for this in a few hours.

mmedum commented 1 year ago

@mmedum,

Huh, bit surprised arch is not a command on your system. What OS are you using?

I will open a fix for this in a few hours.

Endeavouros Cassini 22.12 with sway, which is "just" wrapping arch linux 🙂

vladdoster commented 1 year ago

@mmedum Can you try the following?

cd "$ZINIT[BIN_DIR]" \
&& git pull \
&& git checkout fix/update-linux-pattern \
&& zinit delete --yes BurntSushi/ripgrep \
&& exec zsh -l
vladdoster commented 1 year ago

Here is a simpler recipe using ices lbin'' & lman''.

image

zi for \
   from"gh-r" \
   id-as'rg' \
   lbin'!' \
   lman \
   nocompile \
 @BurntSushi/ripgrep

Ran in a Ubuntu container (Dockerfile)

mmedum commented 1 year ago
zi for \
   from"gh-r" \
   id-as'rg' \
   lbin'!' \
   lman \
   nocompile \
 @BurntSushi/ripgrep

Just tried it directly on my system, it still downloads the wrong binary

~/temp
❯ zi from"gh-r" id-as'rg' lbin'!' lman nocompile for @BurntSushi/ripgrep

Downloading BurntSushi/ripgrep… (at label: rg…)
.zi::get-architecture:3: command not found: arch
(Requesting `ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz'…)
####################################################################################################################################################################################### 100.0%
[ziextract] Unpacking the files from: `ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz'…
[ziextract] Successfully extracted and assigned +x chmod to the file: ripgrep-13.0.0-arm-unknown-linux-gnueabihf/rg.
linkman annex: Installed man page: rg.1
[linkbin annex] Created the rg soft link and set +x on the rg binary
Installed 1 completions. They are stored in the $INSTALLED_COMPS array.

At the moment, I solved it by running

zi ice from"gh-r" as"command" bpick"*musl*" mv"ripgrep* -> rg" pick"rg/rg"
zi light BurntSushi/ripgrep
mmedum commented 1 year ago
cd "$ZINIT[BIN_DIR]" \
&& git pull \
&& git checkout fix/update-linux-pattern \
&& zinit delete --yes BurntSushi/ripgrep \
&& exec zsh -l

This actually ends up with doing the correct thing:

❯ cd "$ZINIT[BIN_DIR]" \
&& git pull \
&& git checkout fix/update-linux-pattern \
&& zinit delete --yes BurntSushi/ripgrep \
&& exec zsh -l
Already up to date.
branch 'fix/update-linux-pattern' set up to track 'origin/fix/update-linux-pattern'.
Switched to a new branch 'fix/update-linux-pattern'

Done (action executed, exit code: 0)

Setting up snippet: https://github.com/ohmyzsh/ohmyzsh/blob/master
Downloading `https://github.com/ohmyzsh/ohmyzsh/blob/master` (with curl, wget, lftp)…
####################################################################################################################################################################################### 100.0%
Note: Compiling: _fd… OK.
Installed 0 completions. They are stored in the $INSTALLED_COMPS array.
Skipped installing 1 completions. They are stored in the $SKIPPED_COMPS array.

Downloading BurntSushi/ripgrep…
(Requesting `ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz'…)
####################################################################################################################################################################################### 100.0%
[ziextract] Unpacking the files from: `ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz'…
[ziextract] Successfully extracted and assigned +x chmod to the file: ripgrep-13.0.0-x86_64-unknown-linux-musl/rg.
renamed 'ripgrep-13.0.0-x86_64-unknown-linux-musl' -> 'rg'
Installed 0 completions. They are stored in the $INSTALLED_COMPS array.
Skipped installing 1 completions. They are stored in the $SKIPPED_COMPS array.
vladdoster commented 1 year ago

@mmedum Open a new terminal window, it is still using the old version. I know that it is the old version because I removed the arch call in the PR.

mmedum commented 1 year ago

@mmedum Open a new terminal window, it is still using the old version. I know that it is the old version because I removed the arch call in the PR.

My mistake :) It seems to work now. Awesome work!

vladdoster commented 1 year ago

cool, I'm going to merge it.

mmedum commented 1 year ago

cool, I'm going to merge it.

Thanks for fixing this!