GNOME Bugzilla – Bug 577727
assertion failure in GOption parsing with "--string-option --other-option" argv
Last modified: 2009-04-02 14:20:01 UTC
Consider these options: static GOptionEntry options[] = { { "string-required", 's', 0, G_OPTION_ARG_STRING, &string, "String", "[ARG]" }, }; (full testcase attached). $ ./testoption --string-required --string-required GLib:ERROR:goption.c:991:parse_arg: assertion failed: (value || OPTIONAL_ARG (entry) || NO_ARG (entry))
+ Trace 214128
Created attachment 131913 [details] testcase
Oops, I made a mistake in comment 0: it happens if you have a G_OPTION_FLAG_OPTIONAL_ARG option. So the correct way to repro is: $ ./testoption --string --string
Created attachment 131914 [details] corrected testcase
Hmm. It seems I misread the docs; they say: G_OPTION_FLAG_OPTIONAL_ARG For options of the G_OPTION_ARG_CALLBACK kind, this flag indicates that the argument supply is optional. If no argument is given then data of GOptionParseFunc will be set to NULL. Since 2.8 So G_OPTION_FLAG_OPTIONAL_ARG doesn't apply to G_OPTION_ARG_STRING. Sorry for the wasted bug.