pg_receivewal, pg_recvlogical: allow canceling initial password prompt

Enterprise / PostgreSQL - Tom Lane [] - 21 November 2021 19:13 UTC

Previously it was impossible to terminate these programs via control-C while they were prompting for a password. We can fix that trivially for their initial password prompts, by moving setup of the SIGINT handler from just before to just after their initial GetConnection() calls.

This fix doesn't permit escaping out of later re-prompts, but those should be exceedingly rare, since the user's password or the server's authentication setup would have to have changed meanwhile. We considered applying a fix similar to commit 46d665bc2, but that seemed more complicated than it'd be worth. Moreover, this way is back-patchable, which that wasn't.

The misbehavior exists in all supported versions, so back-patch to all.

Tom Lane and Nathan Bossart


282b6d00ab pg_receivewal, pg_recvlogical: allow canceling initial password prompt.
src/bin/pg_basebackup/pg_receivewal.c | 12 ++++++++----
src/bin/pg_basebackup/pg_recvlogical.c | 23 ++++++++++++-----------
2 files changed, 20 insertions(+), 15 deletions(-)


  • Share