Re: Fix optind handling inconsistency in getopt_long() for missing argument

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Japin Li <japinli(at)hotmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix optind handling inconsistency in getopt_long() for missing argument
Date: 2026-07-31 03:48:06
Message-ID: amwa9nvUdE5QneAD@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 22, 2026 at 12:22:06PM +0800, Japin Li wrote:
> On Wed, 22 Jul 2026 at 12:17, Japin Li <japinli(at)hotmail(dot)com> wrote:
>> With v2‑0002 applied, the output is:
>>
>> $ ./getopt_long_test --log-filename
>> option '--log-filename' requires an argument
>> $ ./getopt_long_test -f
>> option '-f' requires an argument

Thanks, that saves time. I have been also checking how libc behaves,
debugging more information with optind, argv, optarg, opterr and
optopt with the short and long cases.

One side note: optopt still remains inconsistent compared to our port
version. Not sure if this is worth caring about.. Mentioning
in passing.

> Sorry, I forgot to include the patches in my previous email.

No problem. That happens.

Adjusted on HEAD.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-07-31 03:49:34 Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation
Previous Message David Rowley 2026-07-31 03:40:59 Re: Partition pruning can incorrectly exclude a RANGE default partition