Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Spawning of process failed caused by choosenim using a wrapper process (shim) instead of symbolic link #126

Open
timotheecour opened this issue Jul 12, 2019 · 9 comments

Comments

@timotheecour
Copy link
Contributor

timotheecour commented Jul 12, 2019

choosenim is implemented by a binary that dispatches to the real nim binary; this prevents using lldb -- nim c -r foo, at least on OSX:

I'm curious why isn't choosenim using symbolic links (at least on posix) which seems a simpler approach and avoids this kind of problem ? maybe I'm missing something?

# main.nim ($timn_D/tests/nim/all/t0496.nim)
echo "ok1"
nim c -r main.nim
works
lldb -o run -- /pathto/Nim/nim c -r main.nim
works
choosenim /pathto/Nim/
which nim
/Users/timothee/.nimble//bin/nim

lldb -o run -- nim c -r main.nim
Error: Spawning of process failed. (Error was: Interrupted system call)

i'm on OSX (where gdb isn't supported, only lldb)

nim --version
Nim Compiler Version 0.20.99 [MacOSX: amd64]
Compiled at 2019-07-10
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: cb3c3c306c6507a09c15da26828a39fbbd4dbc66
active boot switches: -d:release

but this bug has always been there

EDIT: related to nim-lang/Nim#9634; I may have a patch but no PR yet; but still genuinely curious why can't symbolic links be used instead, on posix?

@timotheecour timotheecour changed the title Error: Spawning of process failed caused by choosenim using a wrapper process Error: Spawning of process failed caused by choosenim using a wrapper process instead of symbolic link Jul 12, 2019
@dom96
Copy link
Owner

dom96 commented Jul 13, 2019

IIRC the main reason I chose to do it this way is simplicity, supporting both symlinks and this proxy exe would have been more complex.

To be honest I think the underlying bug should be fixed, even if choosenim uses symlinks it won't fix this problem.

@dom96 dom96 closed this as completed Jul 13, 2019
@timotheecour
Copy link
Contributor Author

@timotheecour
Copy link
Contributor Author

hopefully fixed by nim-lang/Nim#13232 but still, symlinks should be used IMO

@timotheecour
Copy link
Contributor Author

actually, this is not fixed, shim/wrapper process causes the following issue:

lldb -o r -o quit /Users/timothee/.nimble//bin/nim

 Error: Spawning of process failed. (Error was: Interrupted system call)
  Info: If unexpected, please report this error to https://github.com/dom96/choosenim

Process 59025 exited with status = 1 (0x00000001)

@timotheecour timotheecour changed the title Error: Spawning of process failed caused by choosenim using a wrapper process instead of symbolic link Error: Spawning of process failed caused by choosenim using a wrapper process (shim) instead of symbolic link Jan 27, 2021
@dom96
Copy link
Owner

dom96 commented Jan 27, 2021

Is this with latest version of choosenim? Can you reproduce it? Does it happen with older versions too?

@dom96 dom96 reopened this Jan 27, 2021
@timotheecour
Copy link
Contributor Author

timotheecour commented Jan 27, 2021

thanks for re-opening, see also nim-lang/Nim#16838 which lists several issues caused by shims instead of symlinks (including one that prevents using testament in nimble tests), and was closed as This is not a Nim issue but a choosenim issue.

This is an important issue that should be tracked and eventually fixed.

Is this with latest version of choosenim?

yes.
choose -v
choosenim v0.7.4 (2020-10-20 17:23:03) [macosx/amd64]

Can you reproduce it?

yes, i retried with latest choosenim (0.7.4) and it results in same error as #126 (comment) for any shim generated by choosenim / proxyexe.

Does it happen with older versions too?

how do I build a shim?

git clone https://github.com/dom96/choosenim && cd choosenim
nim c -o:/tmp/z01 src/choosenimpkg/proxyexe.nim

fails with: cliparams.nim(179, 7) Error: undeclared identifier: 'setNimbleDir'
and setNimbleDir isn't defined in this repo.

@dom96
Copy link
Owner

dom96 commented Jan 27, 2021

how do I build a shim?

Can you just grab the choosenim release from the releases page and use it to install Nim somewhere? You can set a new $HOME or whatever to not overwrite your existing install.

@timotheecour
Copy link
Contributor Author

0.3.0

HOME=/tmp/d09c /Users/timothee/Downloads/choosenim-0.3.0_macosx_amd64 1.4.2

lldb -o r -o quit /tmp/d09c/.nimble/bin/nim

     Error: Traceback (most recent call last)
        ... proxyexe.nim(62)         proxyexe
        ... proxyexe.nim(53)         main
        ... Spawning of process failed. (Error was: Interrupted system call)
      Info: If unexpected, please report this error to https://github.com/dom96/choosenim
Process 57390 exited with status = 1 (0x00000001)

0.7.5

HOME=/tmp/d09b /Users/timothee/Downloads/choosenim-0.7.5-20210102-f338473_macosx_amd64 1.4.2
lldb -o r -o quit /tmp/d09b/.nimble/bin/nim
Error: Spawning of process failed. (Error was: Interrupted system call)
Info: If unexpected, please report this error to https://github.com/dom96/choosenim
Process 49248 exited with status = 1 (0x00000001)

build from source on latest choosenim master

git rev-parse HEAD
f338473
NIMBLE_DIR=$HOME/.nimble_fake50 nimble install
HOME=/tmp/d09 bin/choosenim 1.4.2
lldb -o r -o quit /tmp/d09/.nimble/bin/nim

 Error: Spawning of process failed. (Error was: Interrupted system call)
  Info: If unexpected, please report this error to https://github.com/dom96/choosenim

@timotheecour
Copy link
Contributor Author

timotheecour commented Jan 27, 2021

minimized repro:

import osproc
proc main()=
  let exePath = "/Users/timothee/git_clone/nim/Nim_devel/bin/nim"
  let p = startProcess(exePath, options={poParentStreams})
  let exitCode = p.waitForExit()
  p.close()
main()

nim c -o:/tmp/z01 main
lldb -o r -o quit /tmp/z01

/Users/timothee/git_clone/nim/timn/tests/nim/all/t11753.nim(14) t11753
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11753.nim(11) main
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/osproc.nim(1246) waitForExit
/Users/timothee/git_clone/nim/Nim_devel/lib/pure/includes/oserr.nim(94) raiseOSError
Error: unhandled exception: Interrupted system call [OSError]
Process 79961 exited with status = 1 (0x00000001)

so this points to a nim bug that I'll file and is (hopefully) fixable via something similar to nim-lang/Nim#13232; however, the remaining issues I raised in nim-lang/Nim#16838 are still valid, so there should be at least 1 bug open to track it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants