pgpool2.git / summary / log / commit / refs
commit 7c5ef8d096dc47d7eb62719fed2d73bb94f66586
Author: Bo Peng <pengbo@sraoss.co.jp>
Date: Thu May 09 00:11:06 2024 +0000
Remove leading/trailing spaces in string list type configuration parameters.
If the string list type configuration parameters (e.g. unix_socket_directories, pcp_socket_dir, etc.) contain white spaces, it may cause startup failure.
doc.ja/src/sgml/connection-settings.sgml | 13 +++++++++----
doc/src/sgml/connection-settings.sgml | 11 +++++++----
src/config/pool_config_variables.c | 13 +++++++++++++
3 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/doc.ja/src/sgml/connection-settings.sgml b/doc.ja/src/sgml/connection-settings.sgml
index 91581086a..4e044cf4b 100644
--- a/doc.ja/src/sgml/connection-settings.sgml
+++ b/doc.ja/src/sgml/connection-settings.sgml
@@ -107,13 +107,15 @@
<!--
The directory where the UNIX domain socket(s) accepting connections for
<productname>Pgpool-II</productname> will be created. Multiple sockets
- can be created by listing multiple directories separated by commas. Default
- is <literal>/tmp</literal>. Be aware that this sockets might be deleted
- by a cron job. We recommend to set this value to <literal>/var/run</literal>
- or such directory.
+ can be created by listing multiple directories separated by commas.
+ Leading and trailing spaces in each setting value will be automatically
+ removed. Default is <literal>/tmp</literal>. Be aware that this sockets
+ might be deleted by a cron job. We recommend to set this value to
+ <literal>/var/run</literal> or such directory.
-->
<productname>Pgpool-II</productname>が接続を受け付けるUNIXドメインソケットを置くディレクトリです。
コンマで区切った複数のディレクトリのリストを設定すると複数のUNIXドメインソケットファイルを作成します。
+ 各設定値の先頭と末尾に空白が入っている場合は、自動的に削除されます。
デフォルト値は<literal>/tmp</literal>です。
このソケットは、cron によって削除されることがあるので注意してください。
<literal>/var/run</literal>などのディレクトリに変更することをお勧めします。
@@ -297,6 +299,8 @@
The directory where the UNIX domain socket accepting connections for
PCP process will be created. Multiple sockets can be created
by listing multiple directories separated by commas.
+ Leading and trailing spaces in each setting value will be
+ automatically removed.
Default is <literal>/tmp</literal>. Be aware that
this socket might be deleted by a cron job. We recommend
to set this value to <literal>/var/run</literal> or such
@@ -304,6 +308,7 @@
-->
PCPプロセスが接続を受け付けるUNIXドメインソケットを置くディレクトリです。
コンマで区切った複数のディレクトリのリストを設定すると複数のUNIXドメインソケットファイルを作成します。
+ 各設定値の先頭と末尾に空白が入っている場合は、自動的に削除されます。
デフォルト値は<literal>/tmp</literal>です。
このソケットは、cron によって削除されることがあるので注意してください。
<literal>/var/run</literal>などのディレクトリに変更することをお勧めします。
diff --git a/doc/src/sgml/connection-settings.sgml b/doc/src/sgml/connection-settings.sgml
index 5b0af0a49..34739f234 100644
--- a/doc/src/sgml/connection-settings.sgml
+++ b/doc/src/sgml/connection-settings.sgml
@@ -71,10 +71,11 @@
<para>
The directory where the UNIX domain socket(s) accepting connections for
<productname>Pgpool-II</productname> will be created. Multiple sockets
- can be created by listing multiple directories separated by commas. Default
- is <literal>/tmp</literal>. Be aware that this sockets might be deleted
- by a cron job. We recommend to set this value to <literal>/var/run</literal>
- or such directory.
+ can be created by listing multiple directories separated by commas.
+ Leading and trailing spaces in each setting value will be automatically
+ removed. Default is <literal>/tmp</literal>. Be aware that this sockets
+ might be deleted by a cron job. We recommend to set this value to
+ <literal>/var/run</literal> or such directory.
</para>
<para>
This parameter can only be set at server start.
@@ -191,6 +192,8 @@
The directory where the UNIX domain socket accepting
connections for PCP process will be created. Multiple sockets
can be created by listing multiple directories separated by commas.
+ Leading and trailing spaces in each setting value will be
+ automatically removed.
Default is <literal>/tmp</literal>. Be aware that this socket
might be deleted by a cron job. We recommend to set this
value to <literal>/var/run</literal> or such directory.
diff --git a/src/config/pool_config_variables.c b/src/config/pool_config_variables.c
index 995fd257d..6a32fa2c8 100644
--- a/src/config/pool_config_variables.c
+++ b/src/config/pool_config_variables.c
@@ -3078,6 +3078,19 @@ get_list_from_string(const char *str, const char *delimi, int *n)
for (token = strtok(temp_string, delimi); token != NULL; token = strtok(NULL, delimi))
{
+ int i;
+
+ /* skip leading whitespace */
+ while (isspace(*token))
+ token++;
+
+ /* skip trailing whitespace */
+ i = strlen(token) - 1;
+ while (i >= 0 && isspace(token[i])) {
+ token[i] = '\0';
+ i--;
+ }
+
tokens[*n] = pstrdup(token);
ereport(DEBUG3,
(errmsg("initializing pool configuration"),
[parent: d16cc163a0fe]