dom96 / choosenim

Tool for easily installing and managing multiple versions of the Nim programming language.
BSD 3-Clause "New" or "Revised" License
680 stars 64 forks source link

choosenim stable selects wrong version. #203

Closed pmetras closed 4 years ago

pmetras commented 4 years ago

As far as I know, nim 1.2.0 is current stable version, but choosenim stable selects previous version 1.0.6.

$ choosenim update self
   Updating choosenim
      Info: Already up to date at version 0.6.0
$ choosenim update stable --latest
   Updating stable
      Info: Already up to date at version 1.2.0
   Switched to Nim 1.2.0
$ choosenim stable
   Switched to Nim 1.0.6
$ choosenim show
  Selected: 1.0.6
   Channel: stable
      Path: /home/pmetras/.choosenim/toolchains/nim-1.0.6

  Versions:  
            #devel
            1.2.0
          * 1.0.6

Is there something I don't understand in the way of using choosenim?

genotrance commented 4 years ago

You need to choosenim update stable then your local copy of stable will be updated. Otherwise, every time you switched to stable, it would have to check if stable has been updated and that would be annoying and slow.

pmetras commented 4 years ago

That's what I've already done in the sequence of commands in my example. When I choosenim update stable, the compiler switched to version 1.2.0, but when I choosenim stable it switches back to 1.0.6.

genotrance commented 4 years ago

Sorry I missed that, looks like the stable file isn't getting updated. What's in ~/.choosenim?

pmetras commented 4 years ago
~/.choosenim$ ls -al
total 28
drwxr-xr-x  5 pmetras pmetras 4096 Jun  4 14:20 .
drwxr-xr-x 51 pmetras pmetras 4096 Jun  5 09:01 ..
-rw-r--r--  1 pmetras pmetras    0 Mar  5 09:53 analytics
drwxr-xr-x  2 pmetras pmetras 4096 Apr 22 08:48 channels
-rw-r--r--  1 pmetras pmetras   45 Jun  4 17:22 current
-rw-r--r--  1 pmetras pmetras    5 Jun  4 14:40 current-channel
drwxrwxr-x  2 pmetras pmetras 4096 Jun  4 14:20 downloads
drwxr-xr-x  5 pmetras pmetras 4096 Jun  4 14:20 toolchains

When looking for choosenim, I found that I have 2 instances of the program in ~/.nimble/bin:

/.nimble/bin$ ls -al
total 5820
drwxr-xr-x 2 pmetras pmetras    4096 Apr 29 16:35 .
drwxr-xr-x 4 pmetras pmetras    4096 Apr  2 12:30 ..
-rwxrwxr-- 1 pmetras pmetras 2033960 Apr 29 16:35 choosenim
-rwxr-xr-x 1 pmetras pmetras 2019784 Mar  5 15:25 choosenim_0.5.1
-rwxr--r-- 1 pmetras pmetras  314640 Apr 29 16:35 nim
-rwxr--r-- 1 pmetras pmetras  314640 Apr 29 16:35 nimble
-rwxr--r-- 1 pmetras pmetras  314640 Apr 29 16:35 nimgrep
-rwxr--r-- 1 pmetras pmetras  314640 Apr 29 16:35 nimpretty
-rwxr--r-- 1 pmetras pmetras  314640 May  5 15:33 nimsuggest
-rwxr--r-- 1 pmetras pmetras  314640 Apr 29 16:35 testament

The choosenim_0.5.1 is probably an old version. I'm using version

choosenim v0.6.0 (2020-03-06 18:24:57) [linux/amd64]
genotrance commented 4 years ago

I see the issue - if you choosenim update stable and the new version isn't installed yet (1.2.0 in this case), it will download and install the release and ~/.choosenim/channels/stable gets updated.

If you instead downloaded 1.2.0 separately with choosenim 1.2.0 and then try the above with stable, it does not need to really download anything and the stable file does not get updated.

pmetras commented 4 years ago

Is there something that I can do to correct this situation, for now and for future releases?

I can't remember how version 1.2.0 was downloaded. There are 100% chances that it was with choosenim, but was it with 1.2.0 or stable, I can't remember.