From a0d985b7ad37bb2582d6d92ddd225a9090da1b64 Mon Sep 17 00:00:00 2001
From: David Steele <david@pgmasters.net>
Date: Thu, 7 May 2015 17:37:25 -0500
Subject: [PATCH] Fixed an issue where an absolute path was not written into
 recovery.conf when the restore was run with a relative path.

---
 README.md                           |  2 ++
 doc/doc.xml                         |  3 +++
 lib/BackRest/Config.pm              |  2 +-
 test/lib/BackRestTest/BackupTest.pm |  8 ++++---
 test/lib/BackRestTest/CommonTest.pm | 11 ++++++---
 test/log/backup-synthetic-001.log   | 36 ++++++++++++++---------------
 test/log/backup-synthetic-002.log   | 36 ++++++++++++++---------------
 test/log/backup-synthetic-003.log   | 36 ++++++++++++++---------------
 test/log/backup-synthetic-004.log   | 36 ++++++++++++++---------------
 test/test.pl                        |  6 +++++
 10 files changed, 97 insertions(+), 79 deletions(-)

diff --git a/README.md b/README.md
index dfde90137..06aed8be0 100644
--- a/README.md
+++ b/README.md
@@ -724,6 +724,8 @@ example: db-path=/data/db
 
 * More info messages during restore.  Previously, most of the restore messages were debug level so not a lot was output in the log.
 
+* Fixed an issue where an absolute path was not written into recovery.conf when the restore was run with a relative path.
+
 ### v0.61: bug fix for uncompressed remote destination
 
 * Fixed a buffering error that could occur on large, highly-compressible files when copying to an uncompressed remote destination.  The error was detected in the decompression code and resulted in a failed backup rather than corruption so it should not affect successful backups made with previous versions.
diff --git a/doc/doc.xml b/doc/doc.xml
index aeda17865..ba12d796d 100644
--- a/doc/doc.xml
+++ b/doc/doc.xml
@@ -680,6 +680,9 @@ Run a <id>full</id> backup on the <id>db</id> stanza.  <param>--type</param> can
 					<release-feature>
 						<text>More info messages during restore.  Previously, most of the restore messages were debug level so not a lot was output in the log.</text>
 					</release-feature>
+					<release-feature>
+						<text>Fixed an issue where an absolute path was not written into recovery.conf when the restore was run with a relative path.</text>
+					</release-feature>
 				</release-feature-bullet-list>
 			</release-version>
 
diff --git a/lib/BackRest/Config.pm b/lib/BackRest/Config.pm
index e54c53532..3143246ea 100644
--- a/lib/BackRest/Config.pm
+++ b/lib/BackRest/Config.pm
@@ -1618,7 +1618,7 @@ sub operationWrite
 {
     my $strNewOperation = shift;
 
-    my $strCommand = "$0";
+    my $strCommand = abs_path($0);
 
     foreach my $strOption (sort(keys(%oOption)))
     {
diff --git a/test/lib/BackRestTest/BackupTest.pm b/test/lib/BackRestTest/BackupTest.pm
index 1ab171cd1..bfaa6935f 100755
--- a/test/lib/BackRestTest/BackupTest.pm
+++ b/test/lib/BackRestTest/BackupTest.pm
@@ -251,7 +251,7 @@ sub BackRestTestBackup_ClusterStart
     }
 
     # Creat the archive command
-    my $strArchive = BackRestTestCommon_CommandMainGet() . ' --stanza=' . BackRestTestCommon_StanzaGet() .
+    my $strArchive = BackRestTestCommon_CommandMainAbsGet() . ' --stanza=' . BackRestTestCommon_StanzaGet() .
                      ' --config=' . BackRestTestCommon_DbPathGet() . '/pg_backrest.conf archive-push %p';
 
     # Start the cluster
@@ -869,7 +869,8 @@ sub BackRestTestBackup_BackupBegin
     $strComment = "${strType} backup" . (defined($strComment) ? " (${strComment})" : '');
     &log(INFO, "    $strComment");
 
-    BackRestTestCommon_ExecuteBegin(BackRestTestCommon_CommandMainGet() . ' --config=' .
+    BackRestTestCommon_ExecuteBegin(($bRemote ? BackRestTestCommon_CommandMainAbsGet() : BackRestTestCommon_CommandMainGet()) .
+                                    ' --config=' .
                                     ($bRemote ? BackRestTestCommon_RepoPathGet() : BackRestTestCommon_DbPathGet()) .
                                     "/pg_backrest.conf" . ($bSynthetic ? " --no-start-stop" : '') .
                                     (defined($strOptionalParam) ? " ${strOptionalParam}" : '') .
@@ -1228,7 +1229,8 @@ sub BackRestTestBackup_Restore
     }
 
     # Create the backup command
-    BackRestTestCommon_Execute(BackRestTestCommon_CommandMainGet() . ' --config=' . BackRestTestCommon_DbPathGet() .
+    BackRestTestCommon_Execute(($bRemote ? BackRestTestCommon_CommandMainAbsGet() : BackRestTestCommon_CommandMainGet()) .
+                               ' --config=' . BackRestTestCommon_DbPathGet() .
                                '/pg_backrest.conf'  . (defined($bDelta) && $bDelta ? ' --delta' : '') .
                                (defined($bForce) && $bForce ? ' --force' : '') .
                                ($strBackup ne 'latest' ? " --set=${strBackup}" : '') .
diff --git a/test/lib/BackRestTest/CommonTest.pm b/test/lib/BackRestTest/CommonTest.pm
index 2418cbc6f..1f241a19d 100755
--- a/test/lib/BackRestTest/CommonTest.pm
+++ b/test/lib/BackRestTest/CommonTest.pm
@@ -41,7 +41,7 @@ our @EXPORT = qw(BackRestTestCommon_Create BackRestTestCommon_Drop BackRestTestC
                  BackRestTestCommon_DbCommonPathGet BackRestTestCommon_ClusterStop BackRestTestCommon_DbTablespacePathGet
                  BackRestTestCommon_DbPortGet BackRestTestCommon_iniLoad BackRestTestCommon_iniSave BackRestTestCommon_DbVersion
                  BackRestTestCommon_CommandPsqlGet BackRestTestCommon_DropRepo BackRestTestCommon_CreateRepo
-                 BackRestTestCommon_manifestLoad BackRestTestCommon_manifestSave);
+                 BackRestTestCommon_manifestLoad BackRestTestCommon_manifestSave BackRestTestCommon_CommandMainAbsGet);
 
 my $strPgSqlBin;
 my $strCommonStanza;
@@ -276,7 +276,7 @@ sub BackRestTestCommon_ExecuteBegin
     my $strBinPath = dirname(dirname(abs_path($0))) . '/bin';
     $bFullLog = false;
 
-    if ($strCommandParam =~ /^$strBinPath\/pg_backrest\.pl/)
+    if ($strCommandParam =~ /\/bin\/pg_backrest\.pl/)
     {
         my $strTestPath = BackRestTestCommon_TestPathGet();
 
@@ -610,7 +610,7 @@ sub BackRestTestCommon_Setup
     $strCommonDbCommonPath = "${strCommonTestPath}/db/common";
     $strCommonDbTablespacePath = "${strCommonTestPath}/db/tablespace";
 
-    $strCommonCommandMain = "${strCommonBasePath}/bin/pg_backrest.pl";
+    $strCommonCommandMain = "../bin/pg_backrest.pl";
     $strCommonCommandRemote = "${strCommonBasePath}/bin/pg_backrest_remote.pl";
     $strCommonCommandPsql = "${strPgSqlBin}/psql -X %option% -h ${strCommonDbPath}";
 
@@ -999,6 +999,11 @@ sub BackRestTestCommon_CommandMainGet
     return $strCommonCommandMain;
 }
 
+sub BackRestTestCommon_CommandMainAbsGet
+{
+    return abs_path($strCommonCommandMain);
+}
+
 sub BackRestTestCommon_CommandRemoteGet
 {
     return $strCommonCommandRemote;
diff --git a/test/log/backup-synthetic-001.log b/test/log/backup-synthetic-001.log
index a6a09f5e0..f3bf0ee06 100644
--- a/test/log/backup-synthetic-001.log
+++ b/test/log/backup-synthetic-001.log
@@ -2,7 +2,7 @@ run 001 - rmt 0, cmp 0, hardlink 0
 ==================================
 
 full backup
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --manifest-save-threshold=3 --type=full --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --manifest-save-threshold=3 --type=full --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -38,7 +38,7 @@ full backup
  DEBUG:     safe exit called, terminating threads
 
 full backup (resume)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -73,7 +73,7 @@ full backup (resume)
  DEBUG:     safe exit called, terminating threads
 
 restore delta, backup '[BACKUP_LABEL]' (add and delete files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --delta --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --delta --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -109,7 +109,7 @@ restore delta, backup '[BACKUP_LABEL]' (add and delete files)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (add tablespace 1)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -148,7 +148,7 @@ incr backup (add tablespace 1)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (resume and add tablespace 2)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -193,7 +193,7 @@ incr backup (resume and add tablespace 2)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (cannot resume - new diff)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -240,7 +240,7 @@ diff backup (cannot resume - new diff)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (cannot resume - disabled)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --no-resume --type=diff --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --no-resume --type=diff --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -287,7 +287,7 @@ diff backup (cannot resume - disabled)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 115 (fail on used path)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -302,7 +302,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 115 (fail on used path)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on undef format)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -313,7 +313,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on undef format)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on mismatch format)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -324,7 +324,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on mismatch format)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', remap (remap all paths)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common-2/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -386,7 +386,7 @@ restore, backup '[BACKUP_LABEL]', remap (remap all paths)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (add files and remove tablespace 2)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -425,7 +425,7 @@ incr backup (add files and remove tablespace 2)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (update files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -459,7 +459,7 @@ incr backup (update files)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (no updates)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -509,7 +509,7 @@ diff backup (no updates)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (remove files - but won't affect manifest)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=1
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=1
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -537,7 +537,7 @@ incr backup (remove files - but won't affect manifest)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (remove files during backup)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=1
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=1
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -581,7 +581,7 @@ diff backup (remove files during backup)
  DEBUG:     safe exit called, terminating threads
 
 full backup
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -630,7 +630,7 @@ full backup
  DEBUG:     safe exit called, terminating threads
 
 diff backup (add files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
diff --git a/test/log/backup-synthetic-002.log b/test/log/backup-synthetic-002.log
index 9072db36b..d62eebcb6 100644
--- a/test/log/backup-synthetic-002.log
+++ b/test/log/backup-synthetic-002.log
@@ -2,7 +2,7 @@ run 002 - rmt 0, cmp 0, hardlink 1
 ==================================
 
 full backup
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --manifest-save-threshold=3 --type=full --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --manifest-save-threshold=3 --type=full --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -38,7 +38,7 @@ full backup
  DEBUG:     safe exit called, terminating threads
 
 full backup (resume)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -73,7 +73,7 @@ full backup (resume)
  DEBUG:     safe exit called, terminating threads
 
 restore delta, backup '[BACKUP_LABEL]' (add and delete files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --delta --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --delta --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -109,7 +109,7 @@ restore delta, backup '[BACKUP_LABEL]' (add and delete files)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (add tablespace 1)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -158,7 +158,7 @@ incr backup (add tablespace 1)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (resume and add tablespace 2)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -220,7 +220,7 @@ incr backup (resume and add tablespace 2)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (cannot resume - new diff)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -279,7 +279,7 @@ diff backup (cannot resume - new diff)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (cannot resume - disabled)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --no-resume --type=diff --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --no-resume --type=diff --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -338,7 +338,7 @@ diff backup (cannot resume - disabled)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 115 (fail on used path)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -353,7 +353,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 115 (fail on used path)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on undef format)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -364,7 +364,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on undef format)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on mismatch format)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -375,7 +375,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on mismatch format)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', remap (remap all paths)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common-2/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -437,7 +437,7 @@ restore, backup '[BACKUP_LABEL]', remap (remap all paths)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (add files and remove tablespace 2)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -490,7 +490,7 @@ incr backup (add files and remove tablespace 2)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (update files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -543,7 +543,7 @@ incr backup (update files)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (no updates)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -598,7 +598,7 @@ diff backup (no updates)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (remove files - but won't affect manifest)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=1
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=1
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -650,7 +650,7 @@ incr backup (remove files - but won't affect manifest)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (remove files during backup)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=1
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=1
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -701,7 +701,7 @@ diff backup (remove files during backup)
  DEBUG:     safe exit called, terminating threads
 
 full backup
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -750,7 +750,7 @@ full backup
  DEBUG:     safe exit called, terminating threads
 
 diff backup (add files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
diff --git a/test/log/backup-synthetic-003.log b/test/log/backup-synthetic-003.log
index 05b356154..32072626c 100644
--- a/test/log/backup-synthetic-003.log
+++ b/test/log/backup-synthetic-003.log
@@ -2,7 +2,7 @@ run 003 - rmt 0, cmp 1, hardlink 0
 ==================================
 
 full backup
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --manifest-save-threshold=3 --type=full --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --manifest-save-threshold=3 --type=full --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -38,7 +38,7 @@ full backup
  DEBUG:     safe exit called, terminating threads
 
 full backup (resume)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -75,7 +75,7 @@ full backup (resume)
  DEBUG:     safe exit called, terminating threads
 
 restore delta, backup '[BACKUP_LABEL]' (add and delete files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --delta --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --delta --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -111,7 +111,7 @@ restore delta, backup '[BACKUP_LABEL]' (add and delete files)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (add tablespace 1)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -150,7 +150,7 @@ incr backup (add tablespace 1)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (resume and add tablespace 2)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -196,7 +196,7 @@ incr backup (resume and add tablespace 2)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (cannot resume - new diff)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -243,7 +243,7 @@ diff backup (cannot resume - new diff)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (cannot resume - disabled)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --no-resume --type=diff --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --no-resume --type=diff --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -290,7 +290,7 @@ diff backup (cannot resume - disabled)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 115 (fail on used path)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -305,7 +305,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 115 (fail on used path)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on undef format)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -316,7 +316,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on undef format)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on mismatch format)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -327,7 +327,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on mismatch format)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', remap (remap all paths)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common-2/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -389,7 +389,7 @@ restore, backup '[BACKUP_LABEL]', remap (remap all paths)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (add files and remove tablespace 2)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -428,7 +428,7 @@ incr backup (add files and remove tablespace 2)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (update files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -462,7 +462,7 @@ incr backup (update files)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (no updates)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -512,7 +512,7 @@ diff backup (no updates)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (remove files - but won't affect manifest)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=1
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=1
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -540,7 +540,7 @@ incr backup (remove files - but won't affect manifest)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (remove files during backup)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=1
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=1
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -584,7 +584,7 @@ diff backup (remove files during backup)
  DEBUG:     safe exit called, terminating threads
 
 full backup
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -633,7 +633,7 @@ full backup
  DEBUG:     safe exit called, terminating threads
 
 diff backup (add files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
diff --git a/test/log/backup-synthetic-004.log b/test/log/backup-synthetic-004.log
index 84039fcc6..36cc5e6e4 100644
--- a/test/log/backup-synthetic-004.log
+++ b/test/log/backup-synthetic-004.log
@@ -2,7 +2,7 @@ run 004 - rmt 0, cmp 1, hardlink 1
 ==================================
 
 full backup
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --manifest-save-threshold=3 --type=full --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --manifest-save-threshold=3 --type=full --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -38,7 +38,7 @@ full backup
  DEBUG:     safe exit called, terminating threads
 
 full backup (resume)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -75,7 +75,7 @@ full backup (resume)
  DEBUG:     safe exit called, terminating threads
 
 restore delta, backup '[BACKUP_LABEL]' (add and delete files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --delta --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --delta --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -111,7 +111,7 @@ restore delta, backup '[BACKUP_LABEL]' (add and delete files)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (add tablespace 1)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -160,7 +160,7 @@ incr backup (add tablespace 1)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (resume and add tablespace 2)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -223,7 +223,7 @@ incr backup (resume and add tablespace 2)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (cannot resume - new diff)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -282,7 +282,7 @@ diff backup (cannot resume - new diff)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (cannot resume - disabled)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --no-resume --type=diff --stanza=db backup --test --test-delay=0
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --no-resume --type=diff --stanza=db backup --test --test-delay=0
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -341,7 +341,7 @@ diff backup (cannot resume - disabled)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 115 (fail on used path)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -356,7 +356,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 115 (fail on used path)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on undef format)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -367,7 +367,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on undef format)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on mismatch format)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -378,7 +378,7 @@ restore, backup '[BACKUP_LABEL]', expect exit 104 (fail on mismatch format)
  DEBUG:     safe exit called, terminating threads
 
 restore, backup '[BACKUP_LABEL]', remap (remap all paths)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --set=[BACKUP_LABEL] --stanza=db restore
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     File->exists: db:absolute:[TEST_PATH]/db/common-2/postmaster.pid
   INFO: Restoring backup set [BACKUP_LABEL]
@@ -440,7 +440,7 @@ restore, backup '[BACKUP_LABEL]', remap (remap all paths)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (add files and remove tablespace 2)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -493,7 +493,7 @@ incr backup (add files and remove tablespace 2)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (update files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -546,7 +546,7 @@ incr backup (update files)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (no updates)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -601,7 +601,7 @@ diff backup (no updates)
  DEBUG:     safe exit called, terminating threads
 
 incr backup (remove files - but won't affect manifest)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=1
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --stanza=db backup --test --test-delay=1
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -653,7 +653,7 @@ incr backup (remove files - but won't affect manifest)
  DEBUG:     safe exit called, terminating threads
 
 diff backup (remove files during backup)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=1
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup --test --test-delay=1
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -704,7 +704,7 @@ diff backup (remove files during backup)
  DEBUG:     safe exit called, terminating threads
 
 full backup
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=full --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
@@ -753,7 +753,7 @@ full backup
  DEBUG:     safe exit called, terminating threads
 
 diff backup (add files)
-> [BACKREST_BIN_PATH]/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
+> ../bin/pg_backrest.pl --config=[TEST_PATH]/db/pg_backrest.conf --no-start-stop --type=diff --stanza=db backup
 ------------------------------------------------------------------------------------------------------------------------------------
  DEBUG:     cluster path is [TEST_PATH]/db/common-2
  DEBUG:     File->path_create:  backup:cluster:[TEST_PATH]/backrest/backup/db, mode [undef]
diff --git a/test/test.pl b/test/test.pl
index d1e0cb761..819458eef 100755
--- a/test/test.pl
+++ b/test/test.pl
@@ -118,6 +118,12 @@ if (@ARGV > 0)
     pod2usage();
 }
 
+# Must be run from the test path so relative paths to bin can be tested
+if ($0 ne './test.pl')
+{
+    confess 'test.pl must be run from the test path';
+}
+
 ####################################################################################################################################
 # Setup
 ####################################################################################################################################