Skip to content

Error File exists (os error 17) #89

@jveillet

Description

@jveillet

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.

  • Display a more descriptive error: "Your global version is already set to x.x.x, try removing the alias in ~/.frum/aliases". Not ideal but it gives a direction on how to solve the problem.
  • Change the frum global command so that it overwrites the alias on the ruby version, maybe with a confirmation "You are going to change the global ruby version to x.x.x, are you sure? [y/n]".
  • Display an error when running frum global when the ruby version doesn't exist locally, and maybe better, give the option to download it before setting it as the global version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions