More OpenBSD portability fun: getopt() fails on --option
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Date: 2019-01-18T18:21:40Z
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
Commits
-
Use our own getopt() on OpenBSD.
- e4ffa0dcb797 11.2 landed
- dc2dee438015 9.5.16 landed
- b161ffe31759 9.4.21 landed
- 69bcd718dfd5 12.0 landed
- 167ba6b1569d 9.6.12 landed
- 139e4274263a 10.7 landed