dom96 / choosenim

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

OS error: Permission denied at version `0.5` #147

Closed blueway closed 2 years ago

blueway commented 4 years ago

Spawning of process failed. (Error was: Additional info: "Could not find command: \'~/.choosenim/toolchains/nim-1.0.4/bin/nimble\'. OS error: Permission denied

dom96 commented 4 years ago

Maybe you can check permissions on that file/folder?

blueway commented 4 years ago

The '/.choosenim/toolchains/nim-1.0.4/bin/nimble\' file no execute permission

dom96 commented 4 years ago

I think this is a Nim packaging bug. CC @narimiran @Araq

dom96 commented 4 years ago

But we should probably make choosenim add +x anyway.

dom96 commented 4 years ago

This could also be a problem with the new way 0.5 extracts the tarballs. CC @genotrance

genotrance commented 4 years ago

How did you build choosenim? Can you share the logs of the full build process for choosenim?

I just tried this after rebuilding choosenim from scratch. I am on Ubuntu and was able to choosenim 1.0.4 and it worked just fine.

gt@gt:~/programming/choosenimdevel$ bin/choosenim 1.0.4
Downloading Nim 1.0.4 from nim-lang.org
[##################################################] 100.0% 0kb/s
 Extracting nim-1.0.4-linux_x64.tar.xz
   Building Nim 1.0.4
 Compiler:  Already built
    Tools:  Already built
  Installed component 'nim'
  Installed component 'nimble'
  Installed component 'nimgrep'
  Installed component 'nimpretty'
  Installed component 'nimsuggest'
   Switched to Nim 1.0.4
gt@gt:~/programming/choosenimdevel$ nim -v
Nim Compiler Version 1.0.4 [Linux: amd64]
Compiled at 2019-11-27
Copyright (c) 2006-2019 by Andreas Rumpf

active boot switches: -d:release
gt@gt:~/programming/choosenimdevel$ nimble -v
nimble v0.11.0 compiled at 2019-11-27 09:21:44
git hash: couldn't determine git hash
blueway commented 4 years ago

I am on Ubuntu also

:~/.choosenim/toolchains$  choosenim stable 
Downloading Nim 1.0.4 from nim-lang.org
[##################################################] 100.0% 0kb/s
 Extracting nim-1.0.4-linux_x32.tar.xz
   Building Nim 1.0.4
 Compiler:  Already built
    Tools:  Already built
  Installed component 'nim'
  Installed component 'nimble'
  Installed component 'nimgrep'
  Installed component 'nimpretty'
  Installed component 'nimsuggest'
   Switched to Nim 1.0.4
:~/.choosenim/toolchains$ nim
     Error: Spawning of process failed. (Error was: Additional info: "Could not find command: \'~/.choosenim/toolchains/nim-1.0.4/bin/nim\'. OS error: Permission denied")
      Info: If unexpected, please report this error to https://github.com/dom96/choosenim
dom96 commented 4 years ago

Could not find command: \'/.choosenim/toolchains/nim-1.0.4/bin/nim\'

This is implying to me that it's trying to run /.choosenim/toolchains/nim-1.0.4/bin/nim i.e. there is a missing ~. Could it be that your $HOME isn't set properly?

blueway commented 4 years ago

I delete the $HOME in the comment for safe. None of these files have execute permission in dir ~/.choosenim/toolchains/nim-1.0.4/bin. The problem remains after rebuilding choosenim from source

genotrance commented 4 years ago

Can you please share the full build output for choosenim? Not nimble build which hides the output. Try nim c -f src/choosenim.

paigeweber13 commented 4 years ago

Just installed nim stable with choosenim and had the same problem. After install nothing in ~/.choosenim/toolchains/nim-1.0.4/bin had the executable permission. Running chmod +x fixed it. Would you like more information about my environment or should I report this to nim?

genotrance commented 4 years ago

@rileyweber13 - can you please share if you built choosenim yourself or downloaded a binary? Also, which OS/distro/version?

@dom96 - I can work around this by setting the execute permissions but still no idea why this is failing for users.

paigeweber13 commented 4 years ago

can you please share if you built choosenim yourself or downloaded a binary?

I installed choosenim by running curl https://nim-lang.org/choosenim/init.sh -sSf | sh as the readme indicates. I believe this downloads a binary, but you would know better than me.

Also, which OS/distro/version?

I use KDE Neon. Running lsb_release -a outputs:

Distributor ID: neon
Description:    KDE neon User Edition 5.17
Release:    18.04
Codename:   bionic

Let me know if I can provide any other information!

easbarba commented 4 years ago

Same here:

nimble install nimlsp

Error: Spawning of process failed. (Error was: Additional info: "Could not find command: \'/home/lxbarbosa/.choosenim/toolchains/nim-1.0.4/bin/nimble\'. OS error: Permission denied")
     Info: If unexpected, please report this error to https://github.com/dom96/choosenim
~ $ ls -lha bin/
total 14M
~ $ ls -lha ~/.choosenim/toolchains/nim-1.0.4/bin/
total 14M
drwxr-xr-x  2 lxbarbosa lxbarbosa  4.0K Jan  8 15:35 ./
drwxr-xr-x 16 lxbarbosa lxbarbosa  4.0K Jan  8 15:35 ../
-rw-r--r--  1 lxbarbosa lxbarbosa  4.9M Jan  8 15:35 nim
-rw-r--r--  1 lxbarbosa lxbarbosa 1018K Jan  8 15:35 nimble
-rw-r--r--  1 lxbarbosa lxbarbosa  3.3M Jan  8 15:35 nimfind
-rw-r--r--  1 lxbarbosa lxbarbosa  339K Jan  8 15:35 nimgrep
-rw-r--r--  1 lxbarbosa lxbarbosa  643K Jan  8 15:35 nimpretty
-rw-r--r--  1 lxbarbosa lxbarbosa  2.6M Jan  8 15:35 nimsuggest
-rw-r--r--  1 lxbarbosa lxbarbosa  881K Jan  8 15:35 testament

Installer: curl https://nim-lang.org/choosenim/init.sh -sSf | sh Version: choosenim v0.5.0 (2019-12-18 16:22:28) [linux/amd64] Distributor ID: Debian Description: Debian GNU/Linux bullseye/sid Release: unstable Codename: sid

dom96 commented 4 years ago

Please confirm your choosenim version as well: choosenim -v.

easbarba commented 4 years ago

@dom96 Here goes nothing: choosenim v0.5.0 (2019-12-18 16:22:28) [linux/amd64] :D

genotrance commented 4 years ago

@lxbarbosa - It will be great if you could remove ~/.choosenim, download choosenim manually from the releases page and run ./choosenim --debug 1.0.4 and provide the output. I tried reproducing this with bullseye and sid and had no luck.

easbarba commented 4 years ago

Sorry for the late response. You mean this number? 6cdb780c-dc1f-482c-97bc-649bc7c7c235

Output:

user@debian:~/Downloads$ ./choosenim-0.5.0_linux_amd64 --debug 1.0.4
    Prompt: Can choosenim record and send anonymised telemetry data? [y/n]
        ... Anonymous aggregate user analytics allow us to prioritise
        ... fixes and features based on how, where and when people use Nim.
        ... For more details see: https://goo.gl/NzUEPf.
    Answer: y
      Info: Your client ID is 6cdb780c-dc1f-482c-97bc-649bc7c7c235
     Debug: Reporting to analytics...
     Debug: Reporting to analytics...
Downloading Nim 1.0.4 from nim-lang.org
[##################################################] 100.0% 0kb/s
     Debug: Reporting to analytics...
 Extracting nim-1.0.4-linux_x64.tar.xz
     Debug: Reporting to analytics...
   Building Nim 1.0.4
 Compiler:  Already built
    Tools:  Already built
     Debug: Reporting to analytics...
     Debug: Reporting to analytics...
   Warning: Could not find toolchain's Nimble version.
   Switched to Nim 1.0.4

and yet again:

user@debian:~/Downloads$ ls -lha ~/.choosenim/toolchains/nim-1.0.4/bin/
total 14M
drwxr-xr-x  2 lxbarbosa lxbarbosa  4.0K Jan 10 18:50 .
drwxr-xr-x 16 lxbarbosa lxbarbosa  4.0K Jan 10 18:51 ..
-rw-r--r--  1 lxbarbosa lxbarbosa  4.9M Jan 10 18:50 nim
-rw-r--r--  1 lxbarbosa lxbarbosa 1018K Jan 10 18:50 nimble
-rw-r--r--  1 lxbarbosa lxbarbosa  3.3M Jan 10 18:50 nimfind
-rw-r--r--  1 lxbarbosa lxbarbosa  339K Jan 10 18:50 nimgrep
-rw-r--r--  1 lxbarbosa lxbarbosa  643K Jan 10 18:50 nimpretty
-rw-r--r--  1 lxbarbosa lxbarbosa  2.6M Jan 10 18:50 nimsuggest
-rw-r--r--  1 lxbarbosa lxbarbosa  881K Jan 10 18:50 testament
tebazil commented 4 years ago

Hi! I've just had the same issue on ubuntu 16.04.6 LTS. Fixed it by doing chmod +x to nim

tebazil@localhost:~$ nim -v
     Error: Spawning of process failed. (Error was: Additional info: "Could not find command: \'/home/tebazil/.choosenim/toolchains/nim-1.2.0/bin/nim\'. OS error: Permission denied")
      Info: If unexpected, please report this error to https://github.com/dom96/choosenim
tebazil@localhost:~$ less .choosenim/toolchains/nim-1.2.0/bin/nim
nim         nimble      nimfind     nimgrep     nimpretty   nimsuggest
tebazil@localhost:~$ less .choosenim/toolchains/nim-1.2.0/bin/nim
tebazil@localhost:~$ chmod +x .choosenim/toolchains/nim-1.2.0/bin/nim
tebazil@localhost:~$ nim -v
Nim Compiler Version 1.2.0 [Linux: amd64]
Compiled at 2020-04-03
Copyright (c) 2006-2020 by Andreas Rumpf

active boot switches: -d:release
tebazil@localhost:~$ choosenim -v
choosenim v0.6.0 (2020-03-06 18:24:57) [linux/amd64]
tebazil@localhost:~$ 
dom96 commented 4 years ago

Hrm, this shouldn't happen with 0.6.0 anymore, see https://github.com/dom96/choosenim/blob/master/src/choosenimpkg/builder.nim#L86-L94. Can you unset +x and see if choosenim displays "Setting rwxr-xr-x permissions:" (use --debug to make sure this low priority message is shown)

dom96 commented 3 years ago

Ping @tebazil

tebazil commented 3 years ago

Hi @dom96 , I will try to reproduce this in a few days and let you know how it went. Thanks!

dom96 commented 2 years ago

please reopen if still a problem