Skip to content

koch boot fails if even an empty config.nims is present in ~/.config/nims/ [devel regression] #13633

@kaushalmodi

Description

@kaushalmodi

Building nim devel using koch boot fails after 6b3098c if ~/.config/nim/config.nims file is present, even an empty one.

Example

Build Nim devel as usual. At one point you will reach ./koch boot -d:release.

Current Output

bin/nim jsonscript -d:release --nimcache:nimcache/r_linux_amd64 compiler/nim.nim
Hint: used config file '/home/kmodi/downloads/git/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/kmodi/downloads/git/Nim/config/config.nims' [Conf]
Hint: used config file '/home/kmodi/.config/nim/config.nims' [Conf]
Hint: used config file '/home/kmodi/downloads/git/Nim/compiler/nim.cfg' [Conf]

caught exception:n/home/kmodi/downloads/git/Nim/nimcache/r_linux_amd64/nim.json(2, 1) Error: { expected
stacktrace:
parsejson.nim(522)       raiseParseErr
error evaluating JSON file: /home/kmodi/downloads/git/Nim/nimcache/r_linux_amd64/nim.json
FAILURE

The /home/${USER}/downloads/git/Nim/nimcache/r_linux_amd64/nim.json in the error message is indeed a corrupts JSON.. here are the first few lines from that file:

{"compile":[
,
["/home/kmodi/downloads/git/Nim/nimcache/r_linux_amd64/stdlib_io.nim.c", "gcc -c  -w -O3 -fno-strict-aliasing -fno-ident  -I/home/kmodi/downloads/git/Nim/lib -I/home/kmodi/downloads/git/Nim/compiler -o /home/kmodi/downloads/git/Nim/nimcache/r_linux_amd64/stdlib_io.nim.c.o /home/kmodi/downloads/git/Nim/nimcache/r_linux_amd64/stdlib_io.nim.c"],

Expected Output

nim should build just fine.

If I look at that same nim.json after a successful build, it does not have that lonely comma in the first line..

{"compile":[
["/home/kmodi/downloads/git/Nim/nimcache/r_linux_amd64/stdlib_assertions.nim.c", "gcc -c  -w -O3 -fno-strict-aliasing -fno-ident  -I/home/kmodi/downloads/git/Nim/lib -I/home/kmodi/downloads/git/Nim/compiler -o /home/kmodi/downloads/git/Nim/nimcache/r_linux_amd64/stdlib_assertions.nim.c.o /home/kmodi/downloads/git/Nim/nimcache/r_linux_amd64/stdlib_assertions.nim.c"],

Additional Information

  • This regression happened after 6b3098c
  • If I revert that commit or check out the commit prior to that commit ( i.e. 70bd41d ), the build finishes fine. Note: when trying to reproduce this issue, remember to rm -f the nimcache dir in the Nim build area each time to prevent Nim from parsing the older nim.json.
  • If I delete the ~/.config/nim/config.nims, the build finishes fine.
  • OS: 64-bit Linux -- RHEL 6.8

/cc @Clyybber

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions