Re: log files and permissions - Mailing list pgsql-hackers

From Itagaki Takahiro
Subject Re: log files and permissions
Date
Msg-id AANLkTimeEc6TCk8EJDJazNmweYBs8YXvORknptWksive@mail.gmail.com
Whole thread Raw
In response to log files and permissions  (Martin Pihlak <martin.pihlak@gmail.com>)
Responses Re: log files and permissions
List pgsql-hackers
I checked "log_file_mode GUC" patch, and found a couple of Windows-specific
and translation issues.

* fchmod() is not available on some platforms, including Windows.   fh = fopen(filename, mode);   setvbuf(fh, NULL,
LBF_MODE,0);   fchmod(fileno(fh), Log_file_mode);
 

I think umask()->fopen() is better rather than fopen()->chmod().
See codes in DoCopyTo() at commands/copy.c.

* How does the file mode work on Windows?
If it doesn't work, we should explain it in docs.
Description for .pgpass for Windows might be a help.
| http://developer.postgresql.org/pgdocs/postgres/libpq-pgpass.html
| On Microsoft Windows, ... no special permissions check is made.

* This message format is hard to translate.   ereport(am_rotating ? LOG : FATAL,         (errcode_for_file_access(),
     (errmsg("could not create%slog file \"%s\": %m",                  am_rotating ? " new " : " ", filename))));
 

It might look a duplication of codes, but I think this form is better
because we can reuse the existing translation catalogs.   if (am_rotating)       ereport(FATAL, ... "could not create
logfile ...);   else       ereport(LOG, ... "could not open new log file ...);
 

-- 
Itagaki Takahiro


pgsql-hackers by date:

Previous
From: KaiGai Kohei
Date:
Subject: Re: get_whatever_oid, part 2
Next
From: Itagaki Takahiro
Date:
Subject: Re: patch: to_string, to_array functions