public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/14896] New: getopt_long: optind contains invalid index in very specific cases
@ 2012-11-30 12:18 miguel.a.guedes at gmail dot com
2013-01-09 15:25 ` [Bug libc/14896] " schwab@linux-m68k.org
2014-06-14 7:44 ` fweimer at redhat dot com
0 siblings, 2 replies; 3+ messages in thread
From: miguel.a.guedes at gmail dot com @ 2012-11-30 12:18 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=14896
Bug #: 14896
Summary: getopt_long: optind contains invalid index in very
specific cases
Product: glibc
Version: 2.15
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: unassigned@sourceware.org
ReportedBy: miguel.a.guedes@gmail.com
CC: drepper.fsp@gmail.com
Classification: Unclassified
Created attachment 6765
--> http://sourceware.org/bugzilla/attachment.cgi?id=6765
Test source file that reproduces the bug
This bug affects getopt_long.
In very specific circumstances, optind points to the wrong option when a long
option is not recognised or is invalid.
I've attached a simple test program that reproduces the bug.
Run it like so, ie:
$ gcc test.c -o test && ./test --add -a no_arg lone-value --this-is-long
option add
option a
invalid option: lone-value
non-option ARGV-elements: lone-value
In the example above, getopt_long's internal optind should have skipped
`lone-value' and be pointing at the invalid option `this-is-long'.
Attached source file makes this much clearer.
--
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] 3+ messages in thread
end of thread, other threads:[~2014-06-14 7:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30 12:18 [Bug libc/14896] New: getopt_long: optind contains invalid index in very specific cases miguel.a.guedes at gmail dot com
2013-01-09 15:25 ` [Bug libc/14896] " schwab@linux-m68k.org
2014-06-14 7:44 ` fweimer 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).