Re: PATCH: Configurable file mode mask

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Adam Brightwell <adam(dot)brightwell(at)crunchydata(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Configurable file mode mask
Date: 2018-03-16 15:12:44
Message-ID: 20180316151244.GL2416@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings David, Michael, all,

* David Steele (david(at)pgmasters(dot)net) wrote:
> On 3/15/18 3:17 AM, Michael Paquier wrote:
> > On Wed, Mar 14, 2018 at 02:08:19PM -0400, David Steele wrote:
> >
> > When taking a base backup from a data folder which has group access,
> > then the tar data, as well as the untar'ed data, are still using
> > 0600 as umask for files and 0700 for folders. Is that an expected
> > behavior? I would have imagined that sendFileWithContent() and
> > _tarWriteDir() should enforce the file mode to have group access if the
> > cluster has been initialized to work as such.
>
> We can certainly make base backup understand the group access mode.
> Should we continue hard-coding the mode, or use the actual dir/file mode?

Given that we're already, as I recall, including the owner/group of the
file being backed up through pg_basebackup in the tarball, it seems like
we should be including whatever the current dir/file mode is too. Those
files may not have anything to do with PostgreSQL, after all, and a
'natural' tar of the directory would capture that information too.

> > Still as this is a
> > feature aimed at being used for custom backups, that's not really a
> > blocker I guess.
>
> Seems like a good thing to do, though, so I'll have a look for the next
> patch.

+1.

> > Visibly there would be no need for a -g switch in
> > pg_basebackup as it is possible to guess from the received untar'ed
> > files what should be the permissions of the data based on what is
> > received in pg_basebackup.c. It would also be necessary to change the
> > permissions of pg_wal as this is created before receiving any files.
>
> This part might be trickier.

This seems like another case where what we should be doing, and what
people will be expecting, I'd think, is just what they're used to tar
doing in these cases- which would be setting the dir/file mode for each
file based on what's in the tarball. Again, the files which are in the
data dir are, sadly, not always just those that PG is familiar with.

Thanks!

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-03-16 15:13:03 Re: ON CONFLICT DO UPDATE for partitioned tables
Previous Message Tom Lane 2018-03-16 14:29:04 Re: "SELECT ... FROM DUAL" is not quite as silly as it appears