Fix command-line parsing on Alpine Linux (#905) #1090
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 whenPOSIXLY_CORRECT=1
is set.Fixes #905
Tested the fix by compiling against both the official
postgres:17
(Debian Bookworm / glibc) andpostgres:17-alpine
(Alpine 3.22 / musl) Docker containers and macOS 15.5 Homebrewpostgresql@17
.Without this fix
pg_autoctl
is unusable on Alpine Linux and other musl libc based systems.