Re: Call for objections: deprecate postmaster -o switch?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Call for objections: deprecate postmaster -o switch?
Date: 2001-11-26 02:32:32
Message-ID: 200111260232.fAQ2WWg10286@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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 beginning with '-''-'; change
to match the standard. From Simon J. Gerraty <sjg(at)quick(dot)com(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-11-26 02:39:01 Re: Call for objections: deprecate postmaster -o switch?
Previous Message Tom Lane 2001-11-26 01:50:58 Re: Call for objections: deprecate postmaster -o switch?