babarot / afx

📦 Package manager for CLI
https://babarot.me/afx/
MIT License
150 stars 6 forks source link

self-update failed #47

Closed uga-rosa closed 2 years ago

uga-rosa commented 2 years ago

WHAT

After I run afx self-update, an error zsh: exec format error: afx arised. The version before the update was 1.21. I manually reinserted afx and it fixed, so it seems that the detection of OS or architecture is failing during self-update. I use Ubuntu20.04 on WSL2 and afx_linux_x86_64.tar.gz.

babarot commented 2 years ago

I don't have above environment so I can't reproduce your situation. Maybe related code is here: https://github.com/b4b4r07/afx/blob/master/pkg/github/github.go#L162-L223

Please contribute it

uga-rosa commented 2 years ago

https://github.com/b4b4r07/afx/blob/ee7148103bd3c744a20743e00f7c60e90793cb03/pkg/github/github.go#L207

2022/05/30 10:25:02 [DEBUG] assets.filter: filtered: []string{"afx_linux_arm64.tar.gz", "afx_linux_i386.tar.gz", "afx_linux_x86_64.tar.gz"}
2022/05/30 10:25:02 [DEBUG] assets.filter: filtered: []string{"afx_linux_arm64.tar.gz", "afx_linux_x86_64.tar.gz"}
2022/05/30 10:25:02 [WARN] 2 assets found: []string{"afx_linux_arm64.tar.gz", "afx_linux_x86_64.tar.gz"}
2022/05/30 10:25:02 [WARN] first one "afx_linux_arm64.tar.gz" will be used

It seems that arm64 matches this regex (since it contains 64). I think changing 64 to x86_64 will solve the problem, but will there be any side effects?