From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Refactor dir/file permissions |
Date: | 2018-04-07 21:46:20 |
Message-ID: | E1f4vfA-0006cB-2l@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Refactor dir/file permissions
Consolidate directory and file create permissions for tools which work
with the PG data directory by adding a new module (common/file_perm.c)
that contains variables (pg_file_create_mode, pg_dir_create_mode) and
constants to initialize them (0600 for files and 0700 for directories).
Convert mkdir() calls in the backend to MakePGDirectory() if the
original call used default permissions (always the case for regular PG
directories).
Add tests to make sure permissions in PGDATA are set correctly by the
tools which modify the PG data directory.
Authors: David Steele <david(at)pgmasters(dot)net>,
Adam Brightwell <adam(dot)brightwell(at)crunchydata(dot)com>
Reviewed-By: Michael Paquier, with discussion amongst many others.
Discussion: https://postgr.es/m/ad346fe6-b23e-59f1-ecb7-0e08390ad629%40pgmasters.net
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/da9b580d89903fee871cf54845ffa2b26bda2e11
Modified Files
--------------
src/backend/access/transam/xlog.c | 2 +-
src/backend/commands/tablespace.c | 18 ++++---
src/backend/postmaster/postmaster.c | 7 +--
src/backend/postmaster/syslogger.c | 5 +-
src/backend/replication/basebackup.c | 5 +-
src/backend/replication/slot.c | 5 +-
src/backend/storage/file/copydir.c | 2 +-
src/backend/storage/file/fd.c | 51 +++++++++++++------
src/backend/storage/ipc/dsm_impl.c | 3 +-
src/backend/storage/ipc/ipc.c | 4 ++
src/backend/utils/init/miscinit.c | 5 +-
src/bin/initdb/initdb.c | 24 ++++-----
src/bin/initdb/t/001_initdb.pl | 11 ++++-
src/bin/pg_basebackup/pg_basebackup.c | 9 ++--
src/bin/pg_basebackup/t/010_pg_basebackup.pl | 14 +++++-
src/bin/pg_basebackup/t/020_pg_receivewal.pl | 14 +++++-
src/bin/pg_basebackup/walmethods.c | 6 ++-
src/bin/pg_ctl/pg_ctl.c | 4 +-
src/bin/pg_ctl/t/001_start_stop.pl | 18 ++++++-
src/bin/pg_resetwal/pg_resetwal.c | 5 +-
src/bin/pg_resetwal/t/001_basic.pl | 12 ++++-
src/bin/pg_rewind/RewindTest.pm | 4 ++
src/bin/pg_rewind/file_ops.c | 7 +--
src/bin/pg_rewind/t/001_basic.pl | 11 ++++-
src/bin/pg_upgrade/file.c | 5 +-
src/bin/pg_upgrade/pg_upgrade.c | 3 +-
src/bin/pg_upgrade/test.sh | 11 +++++
src/common/Makefile | 4 +-
src/common/file_perm.c | 19 ++++++++
src/include/common/file_perm.h | 34 +++++++++++++
src/include/storage/fd.h | 3 ++
src/test/perl/PostgresNode.pm | 3 ++
src/test/perl/TestLib.pm | 73 ++++++++++++++++++++++++++++
src/tools/msvc/Mkvcbuild.pm | 4 +-
34 files changed, 330 insertions(+), 75 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-04-07 21:57:30 | Re: pgsql: Support partition pruning at execution time |
Previous Message | David Rowley | 2018-04-07 21:40:39 | Re: pgsql: Support partition pruning at execution time |