After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 305576 - Make glib require argument to G_OPTION_ARG_STRING options.
Make glib require argument to G_OPTION_ARG_STRING options.
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other All
: High enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2005-05-26 19:24 UTC by Björn Lindqvist
Modified: 2005-05-27 18:30 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Björn Lindqvist 2005-05-26 19:24:55 UTC
If you specify an option like this:

{"foo", 0, 0, G_OPTION_ARG_STRING, &bar, NULL, NULL}

and call your program with ./program --foo, glib thinks that you sent an empty
string ("") as option foo's value. It is not quite right and different from how
getopt and popt does it. Instead it should throw an error with the message
"Missing argument to option --foo".
Comment 1 Matthias Clasen 2005-05-27 18:30:52 UTC
2005-05-27  Matthias Clasen  <mclasen@redhat.com>

	* glib/goption.c (parse_short_option, parse_long_option):
	Return an error if an option is missing its argument.  (#305576,
	Björn Lindqvist)

	* tests/option-test.c (missing_arg_test): Add a testcase.