diff --git a/configfile.c b/configfile.c
index b2246de5..c492544d 100644
--- a/configfile.c
+++ b/configfile.c
@@ -73,6 +73,59 @@ load_config(const char *config_file, bool verbose, bool terse, t_configuration_o
strncpy(config_file_path, config_file, MAXPGPATH);
canonicalize_path(config_file_path);
+ /* relative path supplied - convert to absolute path */
+ if (config_file_path[0] != '/')
+ {
+ PQExpBufferData fullpath;
+ char *pwd = NULL;
+
+ initPQExpBuffer(&fullpath);
+
+ /*
+ * we'll attempt to use $PWD to derive the effective path; getcwd()
+ * will likely resolve symlinks, which may result in a path which
+ * isn't permanent (e.g. if filesystem mountpoints change).
+ */
+ pwd = getenv("PWD");
+
+ if (pwd != NULL)
+ {
+ appendPQExpBuffer(&fullpath,
+ "%s", pwd);
+ }
+ else
+ {
+ /* $PWD not available - fall back to getcwd() */
+ char cwd[MAXPGPATH] = "";
+
+ if (getcwd(cwd, MAXPGPATH) == NULL)
+ {
+ log_error(_("unable to execute getcwd()"));
+ log_detail("%s", strerror(errno));
+
+ termPQExpBuffer(&fullpath);
+ exit(ERR_BAD_CONFIG);
+ }
+
+ appendPQExpBuffer(&fullpath,
+ "%s",
+ cwd);
+ }
+
+ appendPQExpBuffer(&fullpath,
+ "/%s", config_file_path);
+
+ log_debug("relative configuration file converted to:\n \"%s\"",
+ fullpath.data);
+
+ strncpy(config_file_path, fullpath.data, MAXPGPATH);
+
+ termPQExpBuffer(&fullpath);
+
+ canonicalize_path(config_file_path);
+ }
+
+
if (stat(config_file_path, &stat_config) != 0)
{
log_error(_("provided configuration file \"%s\" not found: %s"),
@@ -81,6 +134,7 @@ load_config(const char *config_file, bool verbose, bool terse, t_configuration_o
exit(ERR_BAD_CONFIG);
}
+
if (verbose == true)
{
log_notice(_("using provided configuration file \"%s\""), config_file);
diff --git a/doc/configuration-file.sgml b/doc/configuration-file.sgml
index 9c2c1a84..6b097e72 100644
--- a/doc/configuration-file.sgml
+++ b/doc/configuration-file.sgml
@@ -48,4 +48,17 @@
reading the wrong configuraton file.
+
+
+ If providing the configuration file location with -f/--config-file,
+ avoid using a relative path, particularly when executing
+ and , as &repmgr; stores the configuration file location
+ in the repmgr metadata for use when &repmgr; is executed remotely (e.g. during
+ ). &repmgr; will attempt to convert the
+ a relative path into an absolute one, but this may not be the same as the path you
+ would explicitly provide (e.g. ./repmgr.conf might be converted
+ to /path/to/./repmgr.conf, whereas you'd normally write
+ /path/to/repmgr.conf).
+
+
diff --git a/doc/repmgr-primary-register.sgml b/doc/repmgr-primary-register.sgml
index 08208e79..34f78725 100644
--- a/doc/repmgr-primary-register.sgml
+++ b/doc/repmgr-primary-register.sgml
@@ -15,4 +15,18 @@
repmgr master register can be used as an alias for
repmgr primary register.
+
+
+
+ If providing the configuration file location with -f/--config-file,
+ avoid using a relative path, as &repmgr; stores the configuration file location
+ in the repmgr metadata for use when &repmgr; is executed remotely (e.g. during
+ ). &repmgr; will attempt to convert the
+ a relative path into an absolute one, but this may not be the same as the path you
+ would explicitly provide (e.g. ./repmgr.conf might be converted
+ to /path/to/./repmgr.conf, whereas you'd normally write
+ /path/to/repmgr.conf).
+
+
+
diff --git a/doc/repmgr-standby-register.sgml b/doc/repmgr-standby-register.sgml
index 6f553bf6..03628d22 100644
--- a/doc/repmgr-standby-register.sgml
+++ b/doc/repmgr-standby-register.sgml
@@ -10,6 +10,19 @@
standby.
+
+
+ If providing the configuration file location with -f/--config-file,
+ avoid using a relative path, as &repmgr; stores the configuration file location
+ in the repmgr metadata for use when &repmgr; is executed remotely (e.g. during
+ ). &repmgr; will attempt to convert the
+ a relative path into an absolute one, but this may not be the same as the path you
+ would explicitly provide (e.g. ./repmgr.conf might be converted
+ to /path/to/./repmgr.conf, whereas you'd normally write
+ /path/to/repmgr.conf).
+
+
+
Waiting for the registration to propagate to the standby