tristanisham / zvm

zvm (Zig Version Manager) lets you easily install/upgrade between different versions of Zig.
https://www.zvm.app
MIT License
484 stars 32 forks source link

[BUG] Cannot move zls #85

Closed KeithBrown39423 closed 5 months ago

KeithBrown39423 commented 5 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Run zvm install --zls 0.12.0

Expected behavior Install zig 0.12.0 along with zls

Error report

Extracting ZLS...

  Error

2024/06/14 10:05:15 ERRO rename C:\Users\keith\.zvm\0.12.0\bin\zls.exe C:\Users\keith\.zvm\0.12.0\zls.exe: The system cannot find the path specified.

Desktop (please complete the following information):

Configuration:

KeithBrown39423 commented 5 months ago

This is also an issue on arch linux, but the pull request should fix it on all distros and os'

tristanisham commented 5 months ago

Hey @KeithBrown39423

I wrote two small proposals that need to be addressed before a merge, but I'll just do them tonight off of your PR if you can't get to it by then.

tristanisham commented 5 months ago

Referencing #83, which was about this identical issue and has been closed even though it was the first. More progress has been made on this issue.

KeithBrown39423 commented 5 months ago

It appears that in 0.11.0 ZLS is stored in a bin directory which makes this more complicated

tristanisham commented 5 months ago

We can have a check. If the file existed we can move it from bin. If the files are in the root like the new version then we can unbundle using the modern feature.

tristanisham commented 5 months ago

We could even just have a recursive crawl since I'm pretty sure ZLS is compiled statically, no?

siniarskimar commented 5 months ago

It seems that the layout of the release archive has changed since 0.12.0.

Before merging the PR, I think it's important to consider support for older versions.

ZLS looks like is a static executable so it's safe to just copy it into bin/

[marcin:~/.zig]% LC_ALL=C ldd zls # ZLS 0.13.0
     not a dynamic executable
[marcin:~/.zig]% LC_ALL=C ldd zls # ZLS 0.12.0
     not a dynamic executable

Second option is to determine and choose the layout based on downloaded ZLS version. More future-proof, in case ZLS changes the layout again...

tristanisham commented 5 months ago

Okay, I merged the pull request, but let's continue the work here: zls-hotix

siniarskimar commented 5 months ago

I've implemented recursive search of ZLS in #88. It works but has some flaws right now. It doesn't check whenever a candidate is actually an executable and uses filepath.Walk which reads an entire directory tree into memory first.

tristanisham commented 5 months ago

@glyh does this match your issue? I'd like to consolidate all current ZLS errors into this issue if possible.

tristanisham commented 5 months ago

Recursive search seems to have worked perfectly. Adding it to new release. If this doesn't solve the issue, we can reopen this issue.