From 99f78cbcf947d8b25d8198979275e72c01fa42da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Bu=CC=88nemann?= Date: Mon, 14 Jul 2025 16:04:10 +0200 Subject: [PATCH] Fix command-line parsing on Alpine Linux (#905) Add POSIX mode prefix (+) to root option string to ensure consistent getopt behavior between glibc and musl libc. This fixes an issue where subcommand options like 'pg_autoctl create postgres --help' were not being recognized on Alpine Linux due to musl's different handling of unknown options when POSIXLY_CORRECT=1 is set. --- src/bin/pg_autoctl/cli_root.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/pg_autoctl/cli_root.c b/src/bin/pg_autoctl/cli_root.c index 386716b98..073d00e59 100644 --- a/src/bin/pg_autoctl/cli_root.c +++ b/src/bin/pg_autoctl/cli_root.c @@ -162,7 +162,7 @@ root_options(int argc, char **argv) optind = 0; - while ((c = getopt_long(argc, argv, "JVvqh", + while ((c = getopt_long(argc, argv, "+JVvqh", long_options, &option_index)) != -1) { switch (c)