Re: Call for objections: deprecate postmaster -o switch? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Call for objections: deprecate postmaster -o switch?
Date
Msg-id 200111260232.fAQ2WWg10286@candle.pha.pa.us
Whole thread Raw
In response to Re: Call for objections: deprecate postmaster -o switch?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >> (a) did the sort_mem setting "take"?
> 
> > Sure did.  I tried a sort value too low and it complained.  
> 
> Okay, so the original bug is fixed on your version of BSD.  (Which
> is what, again?)

I am using BSD/OS 4.2.  Because the other BSD's mention "--" as
supported, I assume they are OK too.  Perhaps our BSD getopt() is an
older version.

In digging, I see this comment in the getopt.c BSD/OS source:
    * Pick up from where we left off, or start anew if necessary.    * When starting on a new argument, check for "-"
and"--".    * Compatibility exception: a lone "-" is considered an option    * if the option string includes "-".
 

I also see new code handling "--"  However, I don't see this message or
code in the NetBSD getopt.c source.  I do see this NetBSD commit message
from January, 1999:
 1003.2-92 specifies the string "--" to be recognized as the option list delimiter as opposed to any string merely
beginningwith '-''-'; change to match the standard.  From Simon J. Gerraty <sjg@quick.com.au> in PR lib/6762.
 

so it looks like each BSD fixed it in their own way.  Looking at
FreeBSD, I don't see any commit message describing the fix.  If I
compare the NetBSD, FreeBSD, and our own getopt sources, I see this
addition in NetBSD which appears to be the fix mentioned in the NetBSD
commit message above:
               if (place[1] && *++place == '-'        /* found "--" */          -->      && place[1] == '\0') {

And to confirm that, I see at:
 http://cvsweb.netbsd.org/bsdweb.cgi/basesrc/lib/libc/stdlib/getopt.c.diff?r1=1.12&r2=1.13

this exact change:

-               if (place[1] && *++place == '-') {      /* found "--" */
+               if (place[1] && *++place == '-' /* found "--" */
+                   && place[1] == '\0') {

So, every BSD has fixed it themselves, and we should probably apply the
above fix to our own copy, or just grab NetBSD's.  Also, because FreeBSD
doesn't have this fix, we should ask them to add it, and perhaps add a
configure test to see if getopt "--" works on this platform.


> I looked a bit at configure and realized that we have no configure
> test that causes src/utils/getopt.c to be selected.  Apparently,
> the *only* platform where src/utils/getopt.c is used is native WIN32,
> so the "--foo" bug in it is irrelevant to the postmaster anyway.
> But I'm still inclined to fix the bug.
> 
> It would be good to try to get a reading on whether there are any
> current BSD distros that still have the getopt bug.  But what I'm
> inclined to do is note under the description of "--foo" that there
> are a few older platforms where it won't work and you have to use -c,
> rather than writing the docs on the assumption that -c is what most
> people need to use.

Agreed, though we may want to hard-code using our own, fixed getopt()
for FreeBSD.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Call for objections: deprecate postmaster -o switch?
Next
From: Bruce Momjian
Date:
Subject: Re: Call for objections: deprecate postmaster -o switch?