Fix option argument lookup in in-tree getopt_long(). The in-tree getopt_long() moves each non-option to the end of argv, which might put it right where an option's argument lookup expects to find the argument. For example, "vacuumdb postgres --jobs" takes "postgres" as the number of jobs instead of complaining that --jobs is missing its argument. To fix, stop the argument lookups at the start of the moved non-options, which we already track to know when to stop scanning.
Oversight in commit 411b720343. Author: Sehrope Sarkuni <[email protected]> Reviewed-by: solai v <[email protected]> Discussion: https://postgr.es/m/CAH7T-arxDuVCSkorO%3Dk7%2BM-_JV0JFzMpN_EtKMyD2K0RDqZ2OA%40mail.gmail.com Backpatch-through: 17 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a11bce64a3be38f726cdca682f1e5b723cfd34d1 Modified Files -------------- src/bin/scripts/t/100_vacuumdb.pl | 4 ++++ src/port/getopt_long.c | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-)
