More OpenBSD portability fun: getopt() fails on --option - Mailing list pgsql-hackers

From Tom Lane
Subject More OpenBSD portability fun: getopt() fails on --option
Date
Msg-id 30197.1547835700@sss.pgh.pa.us
Whole thread Raw
List 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


pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: jsonpath
Next
From: Vik Fearing
Date:
Subject: Re: [HACKERS] REINDEX CONCURRENTLY 2.0