I'm trying to install packages via nimble, but it hangs at "Downloading https://github.com/whatever using git" and it never proceed past that.
Is that a known issue ?
$ nimble --verbose install polymorph
Reading official package list
Prompt: No local packages.json found, download it from internet? [y/N]
Answer: y
Downloading Official package list
Trying https://github.com/nim-lang/packages/raw/master/packages.json
Success Package list downloaded.
Downloading https://github.com/rlipsc/polymorph using git
Cloning latest tagged version: v0.3.1
it hangs at Cloning
Just tried it, works without problems for me on Windows 10:
D:\>nim --version
Nim Compiler Version 1.6.8 [Windows: amd64]
Compiled at 2022-09-27
Copyright (c) 2006-2021 by Andreas Rumpf
active boot switches: -d:release
D:\>nimble --version
nimble v0.13.1 compiled at 2022-09-27 01:48:19
git hash: couldn't determine git hash
D:\>nimble --verbose install polymorph
Reading official package list
Downloading https://github.com/rlipsc/polymorph using git
Cloning latest tagged version: v0.3.1
Verifying dependencies for [email protected]
Installing [email protected]
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\components.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\components.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\entities.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\entities.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\debugging.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\debugging.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\ecsstatedb.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\ecsstatedb.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\ecsstatedbaccess.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\ecsstatedbaccess.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\ecsstatedbgen.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\ecsstatedbgen.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\eventutils.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\eventutils.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\identities.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\identities.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\mutationtracking.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\mutationtracking.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\nodeutils.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\nodeutils.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\statechangegen.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\statechangegen.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\statechangeutils.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\statechangeutils.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\private\utils.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\private\utils.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\runtimeconstruction.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\runtimeconstruction.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\sealing.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\sealing.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\sharedtypes.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\sharedtypes.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\statechanges.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\statechanges.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph\systems.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph\systems.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\src\polymorph.nim to ...\.nimble\pkgs\polymorph-0.3.1\polymorph.nim
Copying file ...\AppData\Local\Temp\nimble_10968\githubcom_rlipscpolymorph\polymorph.nimble to ...\.nimble\pkgs\polymorph-0.3.1\polymorph.nimble
Success: polymorph installed successfully.
I got really annoyed by this, so i decided to dig a bit more.
$ nimble install pixie --debug
Reading official package list
Downloading https://github.com/treeform/pixie using git
Cloning latest tagged version: 5.0.2
Executing git clone --recursive --depth 1 -b 5.0.2 https://github.com/treeform/pixie /var/folders/76/60fp513x38991r0s6cg_npcw0000gp/T/nimble_40295/githubcom_treeformpixie
this still hangs.
After debugging i discovered that nimble hangs in io.nim procedure readLine of the File type:
var fgetsSuccess: bool
while true:
# fixes #9634; this pattern may need to be abstracted as a template if reused;
# likely other io procs need this for correctness.
fgetsSuccess = c_fgets(cast[cstring](addr line[pos]), sp.cint, f) != nil
if fgetsSuccess: break
when not defined(nimscript):
if errno == EINTR:
errno = 0
c_clearerr(f)
continue
checkErr(f)
break
It's basically hanging in fgets and it never exits the while true. breaking in the debugger, it always breaks into the fgets.
Then decided to try the same command nimble is executing in a nim program:
import std/osproc
when isMainModule:
let cmd = "git clone --config core.autocrlf=false --recursive --depth 1 -b 5.0.2 " &
"https://github.com/treeform/pixie " &
"/var/folders/76/60fp513x38991r0s6cg_npcw0000gp/T/nimble_43913/githubcom_treeformpixie"
execCmdEx(cmd)
and it still hangs for me at the execCmdEx (execProcess and friends produce the same issue).
But then i tried a simple stupid C program, and this magically works.
#include <stdio.h>
#include <stdlib.h>
int main()
{
system("git clone --config core.autocrlf=false --recursive --depth 1 -b 5.0.2 "
"https://github.com/treeform/pixie "
"/var/folders/76/60fp513x38991r0s6cg_npcw0000gp/T/nimble_43913/githubcom_treeformpixie");
return 0;
}
So there is something fishy in the nim io internals.
So there is something fishy in the nim io internals
Well you already are capable of reading Nim's fishy IO internals so please enlighten me and create a PR.
This also works for me:
proc system(cmd: cstring): int {.importc: "system".}
when isMainModule:
let cmd = "git clone --config core.autocrlf=false --recursive --depth 1 -b 5.0.2 " &
"https://github.com/treeform/pixie " &
"/var/folders/76/60fp513x38991r0s6cg_npcw0000gp/T/nimble_43913/githubcom_treeformpixie"
system(cmd.cstring)