TaKO8Ki / frum

A little bit fast and modern Ruby version manager written in Rust
MIT License
628 stars 15 forks source link

Error File exists (os error 17) #89

Closed jveillet closed 3 years ago

jveillet commented 3 years ago

Hi, first, thank you for this wonderful tool, I am using it for a couple of weeks and it works like a charm :)

While playing with it, I encountered a little error though.

I'm on Ubuntu 20.04 (Linux ubuntu 5.4.0-80-generic).

I accidentally run frum global 3.01 while not having installed ruby 3.0.1 before (in fact I add ruby 3.0.2 installed, silly me).

The output of frum versions :

$ frum versions
2.6.7
2.7.3
3.0.2

When I realized that I tried to change by setting frum global 3.02 but got this error:

$ frum global 3.0.2
error: File exists (os error 17)

When I go to the ~/.frum/aliases, I see that there is indeed an existing alias that points to ~/.frum/versions/3.0.1, but this versions doesn't really exists!

Output of ls -la on the versions dir:

$ ls -la ~/.frum/versions
total 24
drwxrwxr-x 6 ubuntu ubuntu 4096 Jul 26 16:07 .
drwxrwxr-x 4 ubuntu ubuntu 4096 Jul 19 09:15 ..
drwxr-xr-x 6 ubuntu ubuntu 4096 Jul 26 16:07 2.6.7
drwxr-xr-x 6 ubuntu ubuntu 4096 Jul 21 16:36 2.7.3
drwxr-xr-x 6 ubuntu ubuntu 4096 Jul 19 09:19 3.0.2
drwxrwxr-x 2 ubuntu ubuntu 4096 Jul 26 16:07 .downloads

I already resolved my problem by removing the alias and set again the frum global command, this time with the good ruby version.

cd ~/.frum/aliases
$ unlink default
frum global 3.0.2

I have some ideas on how to solve that problem, unfortunately I am not proficient enough in Rust to try and suggest a PR.

TaKO8Ki commented 3 years ago

@jveillet Thank you for opening the issue! I think your third suggestion looks good because frum local causes error when the given ruby version doesn't exist locally. I'm going to solve this issue :)