From: Martin Pihlak on 16 Jul 2010 06:15 Tom Lane wrote: > Itagaki Takahiro <itagaki.takahiro(a)gmail.com> writes: >> ... >> We should also check the value not to be something like 0699. >> How about checking it with (file_mode & ~0666) != 0 ? >> ... >> I want show_log_file_mode to print the setting value in octal format. > > It seems like a whole lot of lily-gilding is going on here. Just make > it work like unix_socket_permissions already does. That's been there > for years and nobody has complained about it. > Thanks, somehow I missed that we can already specify octal integers as GUC-s. I now converted the log_file_mode to integer and dropped the assign_log_file_mode function. regards, Martin
From: Tom Lane on 16 Jul 2010 18:34
Martin Pihlak <martin.pihlak(a)gmail.com> writes: > Thanks, somehow I missed that we can already specify octal integers > as GUC-s. I now converted the log_file_mode to integer and dropped > the assign_log_file_mode function. Applied with a few corrections. The noncosmetic changes were: * prevent Log_file_mode from disabling S_IWUSR permissions --- we had better be able to write the files no matter what. * save and restore errno across ereport() call; needed since some callers look at errno after a failure. * make unix_socket_permissions print its value in octal, for consistency with log_file_mode. BTW, I'm not 100% convinced that having the octal show-functions is a good idea, mainly because they aren't consistent with the other columns in pg_settings: regression=# select * from pg_settings where name = 'log_file_mode'; name | setting | unit | category | short_desc | extra_desc | co ntext | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | sourcefile | sourceline ---------------+---------+------+--------------------------------------+-------- ----------------------------------+--------------------------------------------- -------------------------------------------------------------------------------- ----------------------------------------------------------------------------+--- ------+---------+---------+---------+---------+----------+----------+----------- +------------+------------ log_file_mode | 0600 | | Reporting and Logging / Where to Log | Sets th e file permissions for log files. | The parameter value is expected to be a nume ric mode specification in the form accepted by the chmod and umask system calls. (To use the customary octal format the number must start with a 0 (zero).) | si ghup | integer | default | 0 | 511 | | 384 | 384 | | (1 row) I guess this is not strictly incorrect, as long as you understand what the leading '0' means per C conventions, but it looks a bit weird. However, we're not going to be able to improve on this without a lot more hackery than I think it's worth. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers |