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

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
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-21 01:41:16
Message-ID: CAJrrPGfLE58CdN97JeYOb=-Aku=8kG=DSCEZt8p2W=Tigx5BTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 20, 2019 at 4:33 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Fri, Mar 15, 2019 at 06:51:37PM +1100, Haribabu Kommi wrote:
> > IMO, this update is just a recommendation to the user, and sometimes it
> is
> > still possible that there may be strict permissions for the log file
> > even the data directory is allowed for the group access. So I feel
> > it is still better to update the permissions of the current_logfiles
> > to the database files permissions than log file permissions.
>
> I was just reading again this thread, and the suggestions that
> current_logfiles is itself not a log file is also a sensible
> position. I was just looking at the patch that you sent at the top of
> the thread here:
>
> https://www.postgresql.org/message-id/CAJrrPGcEotF1P7AWoeQyD3Pqr-0xkQg_Herv98DjbaMj+naozw@mail.gmail.com
>

Thanks for the review.

> And actually it seems to me that you have a race condition in that
> stuff. I think that you had better use umask(), then fopen, and then
> once again umask() to put back the previous permissions, removing the
> extra chmod() call.
>

Changed the patch to use umask() instead of chmod() according to
your suggestion.

updated patch attached.

Regards,
Haribabu Kommi
Fujitsu Australia

Attachment Content-Type Size
0001-Adjust-current_logfiles-file-permissions_v2.patch application/octet-stream 2.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2019-03-21 01:45:57 Re: MSVC Build support with visual studio 2019
Previous Message Tomas Vondra 2019-03-21 01:32:23 Re: PostgreSQL pollutes the file system