[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#192834: Glibc's method of resetting getopt different, causes interoperability problems



Hi,

> It would be nice if glibc reset its internal state if when optind is set
> to 1, as well as when optind is set to 0.  Historically, the mechanism
> which worked across BSD, AT&T, and most commercial unix systems derived
> from the same require that getopt() be reset by setting optind to 1.
> Setting optind to 0 causes getopt() to misbehave on a number of
> platforms, most notably and most recently Mac OS X, but probably on
> other BSD-derived systems.   
> 
> On the other hand, setting optind to 1 in an attempt to reset things
> causes glibc to core dump under some conditions.
> 
> The lack of interoperability on this point means that I was forced to
> work around the bug in a particularly ugly fashion, as shown below.  
> It would be really nice if I didn't need this kind of kludgery.

Glibc defines optind = 1 in initial state in 2.3.2.ds1-17.  POSIX says
it should be 1 before any calls.  Could you provide us more
information or an example to reappear this report?

Regards,
-- gotom




Reply to: