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

(bugfix): improve gh-r binary selection logic #171

Closed
wants to merge 1 commit into from

Conversation

vladdoster
Copy link
Member

  • fix 🐞 bug: bpick selects Darwin binary when using Manjaro (Arch
    Linux) 🐞 bug: bick default selects darwin when using manjaro #160
  • fix edge cases where Zinit selects a Linux binary on MacOS and
    vice-versa
  • fix zinit not selecting musl version on musl systems
  • add unit tests for gh-r on Ubuntu & MacOS systems to verify logic

Signed-off-by: Vladislav Doster [email protected]

list2=( ${list[@]:#(#i)*.(sha[[:digit:]]#|asc)} )
list2=( ${(M)list[@]:#(#i)*${~matchstr[$OSTYPE(#i)]:-${OSTYPE#(#i)}}*} )

+zinit-message "{pre}.zinit-get-latest-gh-r-url-part{msg2} DEBUG:{msg}" \
Copy link
Member Author

Choose a reason for hiding this comment

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

Added as debug logging in case someone encounters edge case while testing.

Will be removed.

@@ -1447,25 +1447,25 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
local url=https://$urlpart
}

# linux "((#a4)linuxmusl|musl|linux(-|_)gnu]|gnu)"
Copy link
Member Author

Choose a reason for hiding this comment

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

Will be removed.

@sm1999
Copy link

sm1999 commented Jan 30, 2022

I tested this pr and found 2 edge cases for my system( linux amd64 gnu )

  1. For ripgrep ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz release was selected.
DEBUG

.zinit-get-latest-gh-r-url-part DEBUG: `/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/12.1.1/ripgrep-12.1.1-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/12.1.0/ripgrep-12.1.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/12.0.1/ripgrep-12.0.1-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/12.0.0/ripgrep-12.0.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/11.0.2/ripgrep-11.0.2-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/11.0.1/ripgrep-11.0.1-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/11.0.0/ripgrep-11.0.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/0.10.0/ripgrep-0.10.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/0.9.0/ripgrep-0.9.0-arm-unknown-linux-gnueabihf.tar.gz'

  1. For exa exa-linux-x86_64-musl-v0.10.1.zip release was selected over exa-linux-x86_64-v0.10.1.zip
    (might be because of no release containing gnu)
DEBUG

.zinit-get-latest-gh-r-url-part DEBUG: `'

@vladdoster
Copy link
Member Author

vladdoster commented Jan 31, 2022

I tested this pr and found 2 edge cases for my system( linux amd64 gnu )

  1. For ripgrep ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz release was selected.

DEBUG
.zinit-get-latest-gh-r-url-part DEBUG: `/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/12.1.1/ripgrep-12.1.1-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/12.1.0/ripgrep-12.1.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/12.0.1/ripgrep-12.0.1-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/12.0.0/ripgrep-12.0.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/11.0.2/ripgrep-11.0.2-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/11.0.1/ripgrep-11.0.1-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/11.0.0/ripgrep-11.0.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/0.10.0/ripgrep-0.10.0-arm-unknown-linux-gnueabihf.tar.gz /BurntSushi/ripgrep/releases/download/0.9.0/ripgrep-0.9.0-arm-unknown-linux-gnueabihf.tar.gz'

  1. For exa exa-linux-x86_64-musl-v0.10.1.zip release was selected over exa-linux-x86_64-v0.10.1.zip
    (might be because of no release containing gnu)

DEBUG
.zinit-get-latest-gh-r-url-part DEBUG: `'

@sm1999 Do you mind sharing output of uname --all? Can I assume your $OSTYPE is linux-gnu?

Tangential, but did this change allow you to remove any bpicks or break stuff that worked before?

And most important, thank you for taking time to test this out! 🥇 👍🏻

@sm1999
Copy link

sm1999 commented Jan 31, 2022

@vladdoster
uname -all
Linux SM1999-ARCH 5.16.3-arch1-1 #1 SMP PREEMPT Thu, 27 Jan 2022 14:18:25 +0000 x86_64 GNU/Linux

I removed all the bpicks. working great for zoxide, gh cli, micro, bat, hyperfine, fd, lsd,
nnn, antidot, glow, fzf, lazygit.

Thank you for your work!

@vladdoster
Copy link
Member Author

@vladdoster uname -all Linux SM1999-ARCH 5.16.3-arch1-1 #1 SMP PREEMPT Thu, 27 Jan 2022 14:18:25 +0000 x86_64 GNU/Linux

I removed all the bpicks. working great for zoxide, gh cli, micro, bat, hyperfine, fd, lsd, nnn, antidot, glow, fzf, lazygit.

Thank you for your work!

@sm1999 -- Thanks for the info; I'll take a look sometime early this week.

@sm1999
Copy link

sm1999 commented Jan 31, 2022

I also found out that bpick is not working.

armv7l-2 "arm7"
armv6l "(arm6|armv6)"
armv6l-2 "arm"
aarch64-2 "arm"

Choose a reason for hiding this comment

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

Quick question: why not using aarch64 "(aarch64|arm)" ?

@omares
Copy link

omares commented Feb 28, 2022

Hey can we somehow help to get this merged? Zinit unfortunately does not work properly on m1 macs.

@vladdoster vladdoster force-pushed the bugfix/system-gh-r-selection branch 6 times, most recently from d8d265b to 41859ee Compare March 7, 2022 22:32
@vladdoster vladdoster force-pushed the bugfix/system-gh-r-selection branch from f742d1b to b3a72db Compare March 13, 2022 23:26
@vladdoster vladdoster force-pushed the bugfix/system-gh-r-selection branch 7 times, most recently from 043cf01 to af6cf92 Compare March 18, 2022 10:52
@vladdoster vladdoster force-pushed the bugfix/system-gh-r-selection branch from af6cf92 to 32e7586 Compare March 18, 2022 13:59
@vladdoster vladdoster force-pushed the bugfix/system-gh-r-selection branch from a46d16a to 2177790 Compare March 26, 2022 03:48
@vladdoster vladdoster force-pushed the bugfix/system-gh-r-selection branch 3 times, most recently from e48c9f3 to 83df3d6 Compare March 27, 2022 01:24
@vladdoster vladdoster force-pushed the bugfix/system-gh-r-selection branch 9 times, most recently from 2856906 to 6a1d73f Compare March 28, 2022 02:46
- fix [🐞 bug: `bpick` selects Darwin binary when using Manjaro (Arch
  Linux)](#160)
- fix edge cases resulting in the selection of Linux binaries on Darwin
  and vice-versa
- fix zinit incorrect selections for `linux-musl` systems

Signed-off-by: Vladislav Doster <[email protected]>
@vladdoster vladdoster force-pushed the bugfix/system-gh-r-selection branch from 6a1d73f to 410f89d Compare March 28, 2022 02:48
@vladdoster vladdoster closed this Mar 28, 2022
@seagle0128
Copy link

@vladdoster why was this closed? 😢

@vladdoster vladdoster deleted the bugfix/system-gh-r-selection branch April 5, 2022 20:00
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.

6 participants