From 81d01bf0e88003a728bdb318a207c61af6718d10 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Fri, 7 Jun 2019 09:47:20 +0900 Subject: [PATCH] Canonicalize the data directory path when parsing the configuration file This ensures the provided path matches the path PostgreSQL reports as its data directory. --- HISTORY | 1 + configfile.c | 7 ++++++- doc/appendix-release-notes.xml | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/HISTORY b/HISTORY index 9fdfa0e4..9cc1ea56 100644 --- a/HISTORY +++ b/HISTORY @@ -23,6 +23,7 @@ repmgr: prevent a witness server being registered on the cluster primary (John) repmgr: ensure BDR2-specific functionality cannot be used on BDR3 and later (Ian) + repmgr: canonicalize the data directory path (Ian) repmgrd: monitor standbys attached to primary (Ian) repmgrd: add "primary visibility consensus" functionality (Ian) repmgrd: fix memory leak which occurs while the monitored PostgreSQL diff --git a/configfile.c b/configfile.c index 0e5f93b0..d974895f 100644 --- a/configfile.c +++ b/configfile.c @@ -502,10 +502,15 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * else if (strcmp(name, "conninfo") == 0) strncpy(options->conninfo, value, MAXLEN); else if (strcmp(name, "data_directory") == 0) + { strncpy(options->data_directory, value, MAXPGPATH); + canonicalize_path(options->data_directory); + } else if (strcmp(name, "config_directory") == 0) + { strncpy(options->config_directory, value, MAXPGPATH); - + canonicalize_path(options->config_directory); + } else if (strcmp(name, "replication_user") == 0) { if (strlen(value) < sizeof(options->replication_user)) diff --git a/doc/appendix-release-notes.xml b/doc/appendix-release-notes.xml index 872842c0..cb08a81e 100644 --- a/doc/appendix-release-notes.xml +++ b/doc/appendix-release-notes.xml @@ -237,6 +237,16 @@ + + + &repmgr;: canonicalize the data directory path when parsing the configuration file, so + the provided path matches the path PostgreSQL reports as its data directory. + Otherwise, if e.g. the data directory is configured with a trailing slash, + repmgr node check --data-directory-config + will return a spurious error. + + + &repmgrd;: fix memory leak which occurs while the monitored PostgreSQL node is not