Thread: BUG #15502: pg_dump -Fd does not honor umask

BUG #15502: pg_dump -Fd does not honor umask

From
PG Bug reporting form
Date:
The following bug has been logged on the website:

Bug reference:      15502
Logged by:          Kevin Locke
Email address:      kevin@kevinlocke.name
PostgreSQL version: 11.1
Operating system:   Debian GNU/Linux
Description:

The backup file created by `pg_dump -f <path> <db name>` has file
permissions which correspond to the umask for -Fp (plain format), -Fc
(custom format), and -Ft (tar format).  For -Fd (directory format) the .dat
files match the umask, but the containing directory never has group or world
permissions, regardless of the umask.  For example:

$ umask 002 && pg_dump -Fd -f postgres-dump postgres && ls -al
postgres-dump
total 4
drwx------  2 postgres postgres   60 Nov 13 16:23 .
drwxrwxrwt 23 root     root      600 Nov 13 16:23 ..
-rw-r--r--  1 postgres postgres 1032 Nov 13 16:23 toc.dat

The postgres-dump directory is created with mode 0700 instead of 0775 which
would be expected based on the umask (e.g. if mkdir were invoked before
pg_dump).

This does not appear to be a security issue, since the permissions are
always more restrictive than the umask.  It is an inconsistency and minor
annoyance for users which I thought you might like to fix.

Thanks for considering,
Kevin