pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: noah@leadboat.com
Cc: pgsql-hackers@postgresql.org
Subject: Re: add non-option reordering to in-tree getopt_long
Date: Mon, 18 Dec 2023 14:41:22 -0500
Message-ID: <4007895.1702928482@sss.pgh.pa.us> (raw)
In-Reply-To: <ZLDW5HjNS1Ys43xP@paquier.xyz>
References: <20230710.165711.1906730109995973216.horikyota.ntt@gmail.com>
	<20230710181237.GD257945@nathanxps13>
	<20230710200658.GA362078@nathanxps13>
	<20230711.161609.1881651378858129172.horikyota.ntt@gmail.com>
	<20230711163232.GA616878@nathanxps13>
	<20230713034903.GA991765@nathanxps13>
	<ZK+OFMbpICfO1aTR@paquier.xyz>
	<20230713145712.GA1049722@nathanxps13>
	<ZLDOrsxEqbV5vVzx@paquier.xyz>
	<20230714043842.GB327716@nathanxps13>
	<ZLDW5HjNS1Ys43xP@paquier.xyz>

Michael Paquier <michael@paquier.xyz> writes:
> On Thu, Jul 13, 2023 at 09:38:42PM -0700, Nathan Bossart wrote:
>> Take the following examples of client programs that accept one non-option:
>> 
>> ~$ pg_resetwal a b c
>> pg_resetwal: error: too many command-line arguments (first is "b")
>> pg_resetwal: hint: Try "pg_resetwal --help" for more information.
>> 
>> Yet pg_ctl gives:
>> 
>> ~$ pg_ctl start a b c
>> pg_ctl: too many command-line arguments (first is "start")
>> Try "pg_ctl --help" for more information.
>> 
>> In this example, isn't "a" the first extra non-option that should be
>> reported?

> Good point.  This is interpreting "first" as being the first option
> that's invalid.  Here my first impression was that pg_ctl got that
> right, where "first" refers to the first subcommand that would be
> valid.  Objection withdrawn.

We just had a user complaint that seems to trace to exactly this
bogus reporting in pg_ctl [1].  Although I was originally not
very pleased with changing our getopt_long to do switch reordering,
I'm now wondering if we should back-patch these changes as bug
fixes.  It's probably not worth the risk, but ...

			regards, tom lane

[1] https://www.postgresql.org/message-id/flat/CANzqJaDCagH5wNkPQ42%3DFx3mJPR-YnB3PWFdCAYAVdb9%3DQ%2Bt-A...





view thread (37+ messages)  latest in thread

Message-ID: <4007895.1702928482@sss.pgh.pa.us>
Permalink:  ../4007895.1702928482@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4007895.1702928482@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael@paquier.xyz, nathandbossart@gmail.com, horikyota.ntt@gmail.com, noah@leadboat.com
  Subject: Re: add non-option reordering to in-tree getopt_long
  In-Reply-To: <4007895.1702928482@sss.pgh.pa.us>
  References: <20230710.165711.1906730109995973216.horikyota.ntt@gmail.com> <20230710181237.GD257945@nathanxps13> <20230710200658.GA362078@nathanxps13> <20230711.161609.1881651378858129172.horikyota.ntt@gmail.com> <20230711163232.GA616878@nathanxps13> <20230713034903.GA991765@nathanxps13> <ZK+OFMbpICfO1aTR@paquier.xyz> <20230713145712.GA1049722@nathanxps13> <ZLDOrsxEqbV5vVzx@paquier.xyz> <20230714043842.GB327716@nathanxps13> <ZLDW5HjNS1Ys43xP@paquier.xyz> <4007895.1702928482@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox