v1-0001-pg_recvlogical-Honor-source-cluster-file-permissi.patch
application/octet-stream
Filename: v1-0001-pg_recvlogical-Honor-source-cluster-file-permissi.patch
Type: application/octet-stream
Part: 0
From 1a16d814e2ef17c7634bcd3da83980f2aa68a3e5 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Fri, 15 May 2026 22:47:28 +0900
Subject: [PATCH v1] pg_recvlogical: Honor source cluster file permissions for
output files
Commit c37b3d08ca6 attempted to preserve group permissions on pg_recvlogical
output files when group access was enabled on the source cluster. However,
the output files were still created with a fixed S_IRUSR | S_IWUSR mode,
preventing group-read permissions from being applied.
This commit fixes the issue by creating output files with pg_file_create_mode
instead of a hard-coded mode. This allows pg_recvlogical to correctly preserve
group permissions from the source cluster.
Backpatch to all supported branches.
---
doc/src/sgml/ref/pg_recvlogical.sgml | 2 +-
src/bin/pg_basebackup/pg_recvlogical.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/ref/pg_recvlogical.sgml b/doc/src/sgml/ref/pg_recvlogical.sgml
index 5380d776baf..5f76e424e26 100644
--- a/doc/src/sgml/ref/pg_recvlogical.sgml
+++ b/doc/src/sgml/ref/pg_recvlogical.sgml
@@ -494,7 +494,7 @@ PostgreSQL documentation
<para>
<application>pg_recvlogical</application> will preserve group permissions on
- the received WAL files if group permissions are enabled on the source
+ the output files if group permissions are enabled on the source
cluster.
</para>
diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c
index be71783b370..2fdf64bcadb 100644
--- a/src/bin/pg_basebackup/pg_recvlogical.c
+++ b/src/bin/pg_basebackup/pg_recvlogical.c
@@ -342,7 +342,7 @@ StreamLogicalLog(void)
outfd = fileno(stdout);
else
outfd = open(outfile, O_CREAT | O_APPEND | O_WRONLY | PG_BINARY,
- S_IRUSR | S_IWUSR);
+ pg_file_create_mode);
if (outfd == -1)
{
pg_log_error("could not open log file \"%s\": %m", outfile);
--
2.53.0