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
Original bug ID: 7523 Reporter:@c-cube Assigned to:@Octachron Status: resolved (set by @Octachron on 2017-04-26T08:36:08Z) Resolution: fixed Priority: normal Severity: minor Platform: all OS: all Version: 4.03.0 Fixed in version: 4.05.0 +dev/beta1/beta2/beta3/rc1 Category: standard library Has duplicate:#7578
Bug description
When a program written using Arg is not supplied well-formed options on the command line, an error message is displayed. However, in a particular case, the error message is output 3 times, not only one. This case seems to arise when the last parameter is an -option that has a mandatory argument.
The bug can be reproduced from 4.03 up to 4.04.1 and was initially reported by Florian Pichlmeier.
$ ocaml foo.ml --option
foo.ml: option '--option' needs an argument.
some help msg
--option option
-help Display this list of options
--help Display this list of options
foo.ml: foo.ml: option '--option' needs an argument.
some help msg
--option option
-help Display this list of options
--help Display this list of options
.
some help msg
--option option
-help Display this list of options
--help Display this list of options
whereas this works as expected:
$ ocaml foo.ml -bad-option
foo.ml: unknown option '-bad-option'.
some help msg
--option option
-help Display this list of options
--help Display this list of options
The text was updated successfully, but these errors were encountered:
Original bug ID: 7523
Reporter: @c-cube
Assigned to: @Octachron
Status: resolved (set by @Octachron on 2017-04-26T08:36:08Z)
Resolution: fixed
Priority: normal
Severity: minor
Platform: all
OS: all
Version: 4.03.0
Fixed in version: 4.05.0 +dev/beta1/beta2/beta3/rc1
Category: standard library
Has duplicate: #7578
Bug description
When a program written using Arg is not supplied well-formed options on the command line, an error message is displayed. However, in a particular case, the error message is output 3 times, not only one. This case seems to arise when the last parameter is an -option that has a mandatory argument.
The bug can be reproduced from 4.03 up to 4.04.1 and was initially reported by Florian Pichlmeier.
Steps to reproduce
foo.ml
let () =
Arg.parse [
"--option", Arg.String (fun _ -> ()), " option ";
] (fun _ -> ()) "some help msg"
Then,
$ ocaml foo.ml --option
foo.ml: option '--option' needs an argument.
some help msg
--option option
-help Display this list of options
--help Display this list of options
foo.ml: foo.ml: option '--option' needs an argument.
some help msg
--option option
-help Display this list of options
--help Display this list of options
.
some help msg
--option option
-help Display this list of options
--help Display this list of options
whereas this works as expected:
$ ocaml foo.ml -bad-option
foo.ml: unknown option '-bad-option'.
some help msg
--option option
-help Display this list of options
--help Display this list of options
The text was updated successfully, but these errors were encountered: