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

From: Japin Li <japinli(at)hotmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
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 05:27:31
Message-ID: SY7PR01MB10921CA945F2019F87FB78DF6B6C82@SY7PR01MB10921.ausprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

References: <SY7PR01MB10921AF81F18A8BCFA06388BEB6C22(at)SY7PR01MB10921(dot)ausprd01(dot)prod(dot)outlook(dot)com>
<amAhNvNM4I4ATevL(at)paquier(dot)xyz>
<SY7PR01MB10921B103CBDC8A0128D156B5B6C12(at)SY7PR01MB10921(dot)ausprd01(dot)prod(dot)outlook(dot)com>
<SY7PR01MB109210E2A46D09049F98D185AB6C12(at)SY7PR01MB10921(dot)ausprd01(dot)prod(dot)outlook(dot)com>
<amwa9nvUdE5QneAD(at)paquier(dot)xyz>
User-Agent: mu4e 1.14.1; emacs 30.2
Date: Fri, 31 Jul 2026 13:27:31 +0800

<#secure method=pgpmime mode=sign>
On Fri, 31 Jul 2026 at 12:48, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> 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.

Thank you!

> --
> Michael

--
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2026-07-31 05:35:51 Re: sequencesync worker race with REFRESH SEQUENCES
Previous Message Xuneng Zhou 2026-07-31 05:02:12 Re: Implement waiting for wal lsn replay: reloaded