More OpenBSD portability fun: getopt() fails on --option

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: More OpenBSD portability fun: getopt() fails on --option
Date: 2019-01-18 18:21:40
Message-ID: 30197.1547835700@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Continuing the project of getting check-world to pass on OpenBSD 6.4,
I find that the bin/scripts/ tests fall over:

t/090_reindexdb.pl (Wstat: 7424 Tests: 10 Failed: 2)
Failed tests: 9-10
Non-zero exit status: 29
Parse errors: Bad plan. You planned 23 tests but ran 10.
t/091_reindexdb_all.pl (Wstat: 512 Tests: 2 Failed: 2)
Failed tests: 1-2
Non-zero exit status: 2

Investigation shows that the cause of that is that these two scripts
have

$ENV{PGOPTIONS} = '--client-min-messages=WARNING';

which leads to process_postgres_switches() being called with
the argument array [ "postgres", "--client-min-messages=WARNING" ]
and OpenBSD's getopt() fails on that (it returns '?'). I see that
their man page says

A single dash (‘-’) may be specified as a character in optstring,
however it should never have an argument associated with it.

which I take to mean that they broke the case.

configure.in has

# Solaris' getopt() doesn't do what we want for long options, so always use
# our version on that platform.
if test "$PORTNAME" = "solaris"; then
AC_LIBOBJ(getopt)
fi

so I propose that we fix this by doing likewise on OpenBSD.

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2019-01-18 18:58:06 Re: [HACKERS] REINDEX CONCURRENTLY 2.0
Previous Message Alexander Korotkov 2019-01-18 17:58:30 Re: jsonpath