Re: add non-option reordering to in-tree getopt_long
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, noah@leadboat.com, pgsql-hackers@postgresql.org
Date: 2023-07-14T04:27:26Z
Lists: pgsql-hackers
On Thu, Jul 13, 2023 at 07:57:12AM -0700, Nathan Bossart wrote: > Assuming you are referring to [0], it looks like you are missing 411b720. > > [0] https://github.com/michaelpq/postgres/commits/getopt_test Indeed, it looks like I've fat-fingered a rebase here. I am able to get a clean CI run when running this patch, sorry for the noise. Anyway, this introduces a surprising behavior when specifying too many subcommands. On HEAD: $ pg_ctl stop -D $PGDATA kill -t 20 start pg_ctl: too many command-line arguments (first is "stop") Try "pg_ctl --help" for more information. $ pg_ctl stop -D $PGDATA -t 20 start pg_ctl: too many command-line arguments (first is "stop") Try "pg_ctl --help" for more information. With the patch: $ pg_ctl stop -D $PGDATA -t 20 start pg_ctl: too many command-line arguments (first is "start") Try "pg_ctl --help" for more information. $ pg_ctl stop -D $PGDATA kill -t 20 start pg_ctl: too many command-line arguments (first is "kill") Try "pg_ctl --help" for more information. So the error message reported is incorrect now, referring to an incorrect first subcommand. -- Michael
Commits
-
Simplify option handling in pg_ctl.
- 03d1080d8a95 17.0 landed
-
Teach in-tree getopt_long() to move non-options to the end of argv.
- 411b72034300 17.0 landed