You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When cloning nclap, going to branch unnamed_arguments, commit 2d94607a3366656dfe1a64461dc4e1926b1b6587 and running nimble test, I get a Illegal storage access on an object variant because of a field that is not present in this variant
Current Output
Traceback (most recent call last)
nclap/tests/test1.nim(363) test1
nclap/src/nclap/parser.nim(606) parse
nclap/src/nclap/parser.nim(441) parseArgs
/home/user/.choosenim/toolchains/nim-2.2.0/lib/system.nim(1678) getFirstUnregisteredUnnamedArgument
/home/user/.choosenim/toolchains/nim-2.2.0/lib/system/alloc.nim(1147) alloc
/home/user/.choosenim/toolchains/nim-2.2.0/lib/system/alloc.nim(931) rawAlloc
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Error: execution of an external program failed: 'nclap/tests/test1'
Tip: 2 messages have been suppressed, use --verbose to show them.
tools.nim(36) doCmd
Error: Execution failed with exit code 1
... Command: /home/user/.nimble/bin/nim c --noNimblePath -d:NimblePkgVersion=0.1.39 --hints:off -r --path:. nclap/tests/test1
Expected Output
Unhandled exception: field 'ua_name' is not accessible for type 'Argument' using 'kind = Flag' [FieldDefect]
Known Workarounds
Compiling with --mm:refc
Additional Information
No response
The text was updated successfully, but these errors were encountered:
After thorough testing it seems the code isn't the problem or at least not the only problem, the segfaults comes from the standard library module std/unittest, from this test:
test "test":
let default_target ="127.0.0.1"var p = newParser("simple port scanner", DEFAULT_SHOWHELP_SETTINGS, DEFAULT_ENFORCE_SHORT, false, true)
p
.addUnnamedArgument("target", default=some(default_target))
.addFlag("-p", "--ports", "ports to scan", true, true, default=some("1-65535"))
.addFlag("-n", "--no-log", "does not log anything", false, false)
.addFlag("-o", "--output", "outputs the content to a file", true)
.addFlag("-T", "--aggressivity", "outputs the content to a file", true, true)
let args = p.parse(@["-n", "-T=5"])
check not?args.target
check !args.target == default_target
check ?args.no_log
check ?args.aggressivity
When the addUnnamedArgument call (line 6) is removed, the bug doesn't exist anymore
Nim Version
2.2.0
Description
When cloning nclap, going to branch
unnamed_arguments
, commit2d94607a3366656dfe1a64461dc4e1926b1b6587
and runningnimble test
, I get aIllegal storage access
on an object variant because of a field that is not present in this variantCurrent Output
Expected Output
Known Workarounds
Compiling with
--mm:refc
Additional Information
No response
The text was updated successfully, but these errors were encountered: