Re: current_logfiles not following group access and instead follows log_file_mode permissions

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Gilles Darold <gilles(dot)darold(at)dalibo(dot)com>
Subject: Re: current_logfiles not following group access and instead follows log_file_mode permissions
Date: 2019-03-22 01:23:54
Message-ID: 20190322012354.GM20192@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 21, 2019 at 12:52:14PM +1100, Haribabu Kommi wrote:
> Earlier attached patch is wrong.

- oumask = umask(pg_file_create_mode);
+ oumask = umask(pg_mode_mask);
Indeed that was wrong.

> Correct patch attached. Sorry for the inconvenience.

This looks better for the umask setting, still it could be more
simple.

#include <sys/time.h>
-
+#include "common/file_perm.h"
#include "lib/stringinfo.h"
Nit: it is better for readability to keep an empty line between the
system includes and the Postgres ones.

A second thing, more important, is that you can reset umask just after
opening the file, as attached. This way there is no need to reset the
umask in all the code paths leaving update_metainfo_datafile(). Does
that look fine to you?
--
Michael

Attachment Content-Type Size
current-logfiles-perm-v4.patch text/x-diff 971 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-03-22 01:28:08 Re: Special role for subscriptions
Previous Message Takuma Hoshiai 2019-03-22 00:45:09 Re: Proposal to suppress errors thrown by to_reg*()