ID:               36091
 Comment by:       ale at FreeBSD dot org
 Reported By:      oli at isnic dot is
 Status:           Assigned
 Bug Type:         CGI related
 Operating System: FreeBSD 5.4
 PHP Version:      5.1.2, 4.4.2
 Assigned To:      tony2001
 New Comment:

I'm not whining, I'm just tired, very tired to see bug reports from
FreeBSD users tagged as bogus or simply ignored because they are using
the port system of an "unsupported" platform when they are clearly PHP
bugs. You (and this time I mean exactly you, Derick) about two years
ago said to a FreeBSD user to stop sending "make test" reports because
he was using a "non official version of PHP". Since FreeBSD is the most
used *NIX platform with PHP after Linux I would expect more courtesy
from you (all) with our users.

Returning to this bug, the correct way to re-use getopt on *all* BSD
platforms is to reset optind *and* optreset to '1' before every call.
The last comment in the 35594 report says there might be another bug,
but I didn't investigate further.


Previous Comments:
------------------------------------------------------------------------

[2006-01-29 18:13:12] [EMAIL PROTECTED]

@ale: Instead of whining about us doing things wrong on FreeBSD why
don't you give us a patch? This kind of language doesn't make us feel
better about FreeBSD (or its developers).

------------------------------------------------------------------------

[2006-01-29 17:53:50] ale at FreeBSD dot org

Please *stop* saying shit, please! Your attitude towards FreeBSD is
just stupid and all your bug database is pervaded by this arrogance;
accusing FreeBSD for your coding deficiencies is incredibly childish.
Even if you think so, Linux is not the OS reference and the 'optreset'
variable existed *before* the birth of Linux and FreeBSD.

This is taken from 4.3BSD:

     The variables opterr and optind are both initialized to 1.  The
optind
     variable may be set to another value before a set of calls to
getopt() in
     order to skip over more or less argv entries.

     In order to use getopt() to evaluate multiple sets of arguments,
or to
     evaluate a single set of arguments multiple times, the variable
optreset
     must be set to 1 before the second and each additional set of
calls to
     getopt(), and the variable optind must be reinitialized.

     The optreset variable was added to make it possible to call the
getopt()
     function multiple times.

------------------------------------------------------------------------

[2006-01-24 01:15:43] [EMAIL PROTECTED]

Reassigned to myself.
I'll commit the patch as soon as I figure out if it works on Solaris
and AIX.

------------------------------------------------------------------------

[2006-01-20 13:30:34] [EMAIL PROTECTED]

Changing optind re-initalization to optind = 1; fixes it for me on
FreeBSD (and works on Linux).
Though it still makes we wonder why FreeBSD prefers to have its own
implementation of everything: for some reasons they also have `extern
int optreset;`, but it doesn't make any difference whether you change
it or not.

------------------------------------------------------------------------

[2006-01-20 11:31:09] [EMAIL PROTECTED]

Ilia, this is propably some issue on FreeBSD, I can't reproduce with
Linux.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/36091

-- 
Edit this bug report at http://bugs.php.net/?id=36091&edit=1

Reply via email to