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

[bug]: ziextract fails for windows binaries #306

Open
anupamsr opened this issue Jun 9, 2022 · 4 comments
Open

[bug]: ziextract fails for windows binaries #306

anupamsr opened this issue Jun 9, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@anupamsr
Copy link

anupamsr commented Jun 9, 2022

Describe the bug

zinit fails to fetch fetch binaries for windows as it fails in ziextract, such as when using the example of docker/compose from README.md

Steps to reproduce

  1. Run zini for from'gh-r' as'program' stedolan/jq
  2. ziextract: WARNING: extraction of the archive 'jq-win32.exe' had problems.

Expected behavior

It should download the binary correctly

Screenshots and recordings

...
ziextract: Unpacking the files from: `jq-win32.exe'
++zinit-message:27> [[ -n '' || -z '' ]]
++zinit-message:28> print -n $'\C-M'
+.zinit-extract-wrapper:4> →zinit-extract
+→zinit-extract:1> chmod a+x -- ./jq-win32.exe
+→zinit-extract:2> cygpath -w /home/srivastavaan/.local/share/zinit/plugins/stedolan---jq
+→zinit-extract:2> ./jq-win32.exe /S '/D=E:\scoop\apps\msys2\2022-06-03\home\srivastavaan\.local\share\zinit\plugins\stedolan---jq'
jq: error: syntax error, unexpected ':', expecting $end (Windows cmd shell quoting issues?) at <top-level>, line 1:
S:/
jq: 1 compile error
+.zinit-extract-wrapper:4> retval=3
+.zinit-extract-wrapper:5> ((  retval == 0  ))
+.zinit-extract-wrapper:10> return 3

Operating System & Version

msys | pc | x86_64 | x86_64 | x86_64 unknown

Zsh version

zsh 5.8 (x86_64-pc-msys)

Terminal emulator

xterm-256color (actually MINTTY shipped with msys2)

If using WSL on Windows, which version of WSL

No response

Additional context

No response

@anupamsr anupamsr added the bug Something isn't working label Jun 9, 2022
@anupamsr
Copy link
Author

anupamsr commented Jun 9, 2022

It looks like we assume the exe is an installer and we try to extract it. In case where the exe is actual binary, the command to extract fails.

@vladdoster
Copy link
Member

@anupamsr Do you happen to know if this issue just started occurring?

@anupamsr
Copy link
Author

anupamsr commented Jun 14, 2022

No, this is the first time I have tried to use zinit on msys2 environment. I was able to fix it on my local machine with this patch:

diff --git a/zinit-install.zsh b/zinit-install.zsh
index 379a2279..593469e4 100644
--- a/zinit-install.zsh
+++ b/zinit-install.zsh
@@ -1810,7 +1810,7 @@ ziextract() {
         ((#i)*.rpm)
             →zinit-extract() { →zinit-check cpio "$file" || return 1; $ZINIT[BIN_DIR]/share/rpm2cpio.zsh "$file" | command cpio -imd --no-absolute-filenames; }
             ;;
-        ((#i)*.exe|(#i)*.pe32)
+        ((#i)*.pe32)
             →zinit-extract() {
                 command chmod a+x -- ./$file
                 ./$file /S /D="`cygpath -w $PWD`"

I am not sure if it will break someone else's workflow. To be honest, I think it is best not to assume that the binary we are trying to extract is an installer which will consume those arguments, but may better minds prevail...

@vladdoster
Copy link
Member

@anupamsr I'll open a PR this week to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants