public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [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; 5+ 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] 5+ 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: getopt_long does *not* return (or indicate in any way) error condition (if occured) to programmer edvotsyivj at datatech dot ru
@ 2007-03-01 14:55 ` edvotsyivj at datatech dot ru
  0 siblings, 0 replies; 5+ 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] 5+ messages in thread

* [Bug libc/4116] getopt_long does *not* return (or indicate in any way) error condition (if occured) to programmer.
       [not found] <bug-4116-131@http.sourceware.org/bugzilla/>
  2012-12-19 10:48 ` schwab@linux-m68k.org
@ 2012-12-19 13:48 ` eblake at redhat dot com
  1 sibling, 0 replies; 5+ messages in thread
From: eblake at redhat dot com @ 2012-12-19 13:48 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=4116

Eric Blake <eblake at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|ebb9 at byu dot net         |eblake at redhat dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4116] getopt_long does *not* return (or indicate in any way) error condition (if occured) to programmer.
       [not found] <bug-4116-131@http.sourceware.org/bugzilla/>
@ 2012-12-19 10:48 ` schwab@linux-m68k.org
  2012-12-19 13:48 ` eblake at redhat dot com
  1 sibling, 0 replies; 5+ messages in thread
From: schwab@linux-m68k.org @ 2012-12-19 10:48 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=4116

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|drepper.fsp at gmail dot    |unassigned at sourceware
                   |com                         |dot org

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/4116] getopt_long does *not* return (or indicate in any way) error condition (if occured) to programmer.
       [not found] <20070301115804.4116.yiarreshios@datatech.ru>
@ 2009-12-02  0:59 ` ebb9 at byu dot net
  0 siblings, 0 replies; 5+ messages in thread
From: ebb9 at byu dot net @ 2009-12-02  0:59 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebb9 at byu dot net


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] 5+ messages in thread

end of thread, other threads:[~2012-12-19 13:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-01 11:58 [Bug libc/4116] New: getopt_long does *not* return (or indicate in any way) error condition (if occured) to programmer edvotsyivj at datatech dot ru
2007-03-01 14:55 ` [Bug libc/4116] " edvotsyivj at datatech dot ru
     [not found] <20070301115804.4116.yiarreshios@datatech.ru>
2009-12-02  0:59 ` ebb9 at byu dot net
     [not found] <bug-4116-131@http.sourceware.org/bugzilla/>
2012-12-19 10:48 ` schwab@linux-m68k.org
2012-12-19 13:48 ` eblake at redhat dot com

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).