public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <20070301115804.4116.yiarreshios@datatech.ru>]
* [Bug libc/4116] New: getopt_long does *not* return (or indicate in any way) error condition (if occured) to programmer.
@ 2007-03-01 11:58 edvotsyivj at datatech dot ru
2007-03-01 14:55 ` [Bug libc/4116] " edvotsyivj at datatech dot ru
0 siblings, 1 reply; 4+ messages in thread
From: edvotsyivj at datatech dot ru @ 2007-03-01 11:58 UTC (permalink / raw)
To: glibc-bugs
There are a lot of situations, where errors in options (and its arguments) can
not be reported to user by "getopt" internal routine:
fprintf (stderr, _("%s: option `%s' ...
That's why variable "opterr" and optstring prefix ":" do exist: for disabling
"getopt" internal error reporting. The most apparent examples of such situations
are:
-- we need to localize error messages for application which does not use
gettext, because it's mono-language (but not English).
-- in GUI application stderr is not visible to user (or even closed), and we
need to display errors in dialog window.
The plain short-option "getopt" provides programmer with sufficient information
to catch and handle errors: ":"/"?" as return code and "optopt" as subject of error.
But "getopt_long" provides NONE information to programmer. There are at least 4
(four) indistinguishable error conditions:
1) option is ambiguous
2) unrecognized/invalid option
3) option doesn't allow an argument
4) option requires an argument
In either of above "getopt_long" just return "?", leaving the programmer to
guess what's happened. Moreover, in cases (1) and (2) programmer doesn't even
know, which option has triggered the error.
So, "getopt_long" must be fixed to indicate
A) different error conditions
B) the option (text) caused the error
--
Summary: getopt_long does *not* return (or indicate in any way)
error condition (if occured) to programmer.
Product: glibc
Version: 2.4
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: edvotsyivj at datatech dot ru
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=4116
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/4116] getopt_long does *not* return (or indicate in any way) error condition (if occured) to programmer.
2007-03-01 11:58 [Bug libc/4116] New: " edvotsyivj at datatech dot ru
@ 2007-03-01 14:55 ` edvotsyivj at datatech dot ru
0 siblings, 0 replies; 4+ messages in thread
From: edvotsyivj at datatech dot ru @ 2007-03-01 14:55 UTC (permalink / raw)
To: glibc-bugs
------- Additional Comments From edvotsyivj at datatech dot ru 2007-03-01 14:54 -------
Though "getopt_long" points to an option in question in case of errors:
3) option doesn't allow an argument
4) option requires an argument
... by setting "optopt" variable, but leaves it's "longind" parameter untouched.
This cause programmer either scan "longopts" array, or build one more
"switch(...)" to find the option in question.
So, "getopt_long" should be fixed to set "longind"
--
http://sourceware.org/bugzilla/show_bug.cgi?id=4116
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-19 13:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-4116-131@http.sourceware.org/bugzilla/>
2012-12-19 10:48 ` [Bug libc/4116] getopt_long does *not* return (or indicate in any way) error condition (if occured) to programmer schwab@linux-m68k.org
2012-12-19 13:48 ` eblake at redhat dot com
[not found] <20070301115804.4116.yiarreshios@datatech.ru>
2009-12-02 0:59 ` ebb9 at byu dot net
2007-03-01 11:58 [Bug libc/4116] New: " edvotsyivj at datatech dot ru
2007-03-01 14:55 ` [Bug libc/4116] " edvotsyivj at datatech dot ru
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).