nim-lang / nimble

Package manager for the Nim programming language.
https://nim-lang.github.io/nimble/index.html
Other
1.26k stars 192 forks source link

crash in parsing the version [regression] #563

Closed krux02 closed 5 years ago

krux02 commented 6 years ago

This is my config for a long time now. I didn't change anything recently.

version       = "0.3.1"
author        = "Arne Döring"
description   = "nice way of handling render code"
license       = "MIT"

bin           = @[
  "examples/deferred_shading",
  "examples/forward_vertex_shader",
  "examples/hello_shapes",
  "examples/hello_triangle",
  "examples/mandelbrot",
  "examples/iqm_mesh_loading",
  "examples/neuralnetwork",
  "examples/noise_landscape",
  "examples/particles",
  "examples/particles_transform_feedback",
  "examples/player_controls",
  "examples/retro_tiling",
  "examples/sandbox",
  "examples/tetris",
  "examples/waves",
  "examples/console",
]

skipDirs = @["unittests", "experiment"]

#[ Dependencies ]#

requires @[
  "nim                  >= 0.18.1  ",
  "AntTweakBar          >= 1.0.2   ",
  "sdl2_nim             >= 2.0.6.1 ",
  "glm                  >= 1.1.1   ",
  "ast_pattern_matching >= 1.0.0   ",
  #"fftw3               >= 0.1.0   ", # add this if you want audiotest to work
]

task run, "run all examples":
  for binary in bin:
    exec(binary)

This is the strack trace of nimble build

nimble.nim(1105)         nimble
nimble.nim(1063)         doAction
nimble.nim(505)          build
packageparser.nim(410)   getPkgInfo
packageparser.nim(398)   getPkgInfoFromFile
packageparser.nim(349)   readPackageInfo
nimscriptsupport.nim(589) readPackageInfoFromNims
nimscriptsupport.nim(86) extractRequires
version.nim(218)         parseRequires
version.nim(193)         parseVersionRange
system.nim(2939)         sysFatal
Error: unhandled exception: index out of bounds [IndexError]
dom96 commented 6 years ago

Should be easy to fix in case anyone wants to give it a try. I'm guessing it's caused by the \0 no longer being accessible in strings. So:

krux02 commented 6 years ago

yes it's an easy fix, but I haven't fully figured out how nimble is actually build with ./koch tools. How do I apply a fix and install that changed nimble version locally?

dom96 commented 6 years ago

nimble install in nimble's source code directory.

LemonBoy commented 6 years ago

I guess that it's just a matter of changing this line:

if version != "" and i < s.len:

into this:

if version != "" and i < s.len - 1:
krux02 commented 6 years ago

@LemonBoy yes it is