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
There's a bug somewhere in flag.FlagParser that looks like it eats h characters from other input flags/arguments.
Reproduction Steps
v run bug.v:
bug.v:
modulemainimportflagpubstructOptions {
pub:
verbosity int
dump_usage boolpubmut:
additional_args []string
archs []string
v_flags []string
api_level string
}
fnmain() {
args:= ['/my/app', '-v', '3', '-f', '-d sdl_memory_no_gc', '-f', '-d shy_use_wren', '--api',
'21', '--archs', 'arm64-v8a', '/path/to/input.v']
mutfp:= flag.new_flag_parser(args)
fp.application('bug')
fp.version('0.2.0')
fp.description('bugged')
fp.arguments_description('not important')
fp.skip_executable()
mutopt:= Options{
v_flags: fp.string_multi('flag', `f`, 'Additional flags for the V compiler')
archs: fp.string('archs', 0, 'arm64-v8a,armeabi-v7a,x86,x86_64', 'Comma separated string with any of archs').split(',')
dump_usage: fp.bool('help', `h`, false, 'Show this help message and exit')
verbosity: fp.int_opt('verbosity', `v`, 'Verbosity level 1-3') or { 0 }
api_level: fp.string('api', 0, '21', 'Android API level to use (--list-apis)')
}
opt.additional_args= fp.finalize() or { panic(err) }
assert opt.v_flags[0] =='-d sdl_memory_no_gc'assert opt.v_flags[1] =='-d shy_use_wren'// looks like the builtin support for `-h` eats the "h" in this flagassert opt.dump_usage==false
}
Expected Behavior
No assert failures
Current Behavior
./bug.v:41: FAIL: fn main.main: assert opt.v_flags[1] == '-d shy_use_wren'
left value: opt.v_flags[1] = -d sy_use_wren
right value: '-d shy_use_wren' = -d shy_use_wren
V panic: Assertion failed...
v hash: 0a61b4a
/dev/shm/v_1000/bug.01J6VQ1CTXWF36ZDQWPBJYG42P.tmp.c:7505: at _v_panic: Backtrace
/dev/shm/v_1000/bug.01J6VQ1CTXWF36ZDQWPBJYG42P.tmp.c:15316: by main__main
/dev/shm/v_1000/bug.01J6VQ1CTXWF36ZDQWPBJYG42P.tmp.c:15375: by main
Describe the bug
There's a bug somewhere in
flag.FlagParser
that looks like it eatsh
characters from other input flags/arguments.Reproduction Steps
v run bug.v
:bug.v
:Expected Behavior
No assert failures
Current Behavior
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.7 0a61b4a
Environment details (OS name and version, etc.)
Linux, EndeavourOS (Arch-based)
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: