From 1da63aff07de90cd7734b5afd2674b1452c59cf3 Mon Sep 17 00:00:00 2001 From: David Steele Date: Mon, 20 Nov 2017 12:46:35 -0500 Subject: [PATCH] Fixed an issue with invalid backup groups being set correctly on restore. If the backup cannot map a group to a name it stores the group in the manifest as false then uses either the owner of $PGDATA to set the group during restore or failing that the group of the current user. This logic was not working correctly because the selected group was overwriting the user on restore leaving the group undefined and the user incorrectly set to the group. (Reported by Jeff McCormick.) --- doc/xml/release.xml | 13 ++++ lib/pgBackRest/Restore.pm | 2 +- test/expect/mock-all-001.log | 72 ++++++++++++++----- .../pgBackRestTest/Module/Mock/MockAllTest.pm | 53 ++++++++++++-- 4 files changed, 116 insertions(+), 24 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index e23bdc53e..983618a08 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -37,6 +37,14 @@

Fixed an issue retrieving WAL for old database versions. After a stanza-upgrade it should still be possible to restore backups from the previous version and perform recovery with archive-get. However, archive-get only checked the most recent db version/id and failed. Also clean up some issues when the same db version/id appears multiple times in the history.

+ + + + + + +

Fixed an issue with invalid backup groups being set correctly on restore. If the backup cannot map a group to a name it stores the group in the manifest as false then uses either the owner of $PGDATA to set the group during restore or failing that the group of the current user. This logic was not working correctly because the selected group was overwriting the user on restore leaving the group undefined and the user incorrectly set to the group.

+
@@ -3677,6 +3685,11 @@ LaetitiaLoxo + + Jeff McCormick + jmccormick2001 + + Jason O'Donnell Dwaligon diff --git a/lib/pgBackRest/Restore.pm b/lib/pgBackRest/Restore.pm index fef429660..2ef1e7d4e 100644 --- a/lib/pgBackRest/Restore.pm +++ b/lib/pgBackRest/Restore.pm @@ -111,7 +111,7 @@ sub manifestOwnershipCheck } else { - $oOwnerTypeHash{&MANIFEST_SUBKEY_USER} = getgrgid($(); + $oOwnerTypeHash{&MANIFEST_SUBKEY_GROUP} = getgrgid($(); } # Loop through owner types (user, group) diff --git a/test/expect/mock-all-001.log b/test/expect/mock-all-001.log index cde90004b..fbb2457f3 100644 --- a/test/expect/mock-all-001.log +++ b/test/expect/mock-all-001.log @@ -939,7 +939,7 @@ group="[GROUP-1]" user="[USER-1]" [target:path] -pg_data={} +pg_data={"group":false,"mode":"0777","user":false} pg_data/base={} pg_data/base/1={} pg_data/base/16384={} @@ -1039,8 +1039,10 @@ P00 DEBUG: Storage::Local->encryptionValid=>: bValid = true P00 DEBUG: Storage::Local->openRead(): bIgnoreMissing = true, rhyFilter = [undef], strCipherPass = [undef], xFileExp = [TEST_PATH]/db-master/db/base/backup.manifest P00 DEBUG: Storage::Base->get(): strCipherPass = [undef], xFile = [object] P00 DEBUG: Restore->manifestOwnershipCheck(): oManifest = [object] -P00 WARN: backup group for pg_data/base/16384/PG_VERSION was not mapped to a name, set to [GROUP-1] -P00 WARN: backup user for pg_data/base/1/PG_VERSION was not mapped to a name, set to [USER-1] +P00 WARN: backup group for pg_data/base/16384/PG_VERSION was not mapped to a name, set to [GROUP-2] +P00 WARN: backup group for pg_data was not mapped to a name, set to [GROUP-2] +P00 WARN: backup user for pg_data/base/1/PG_VERSION was not mapped to a name, set to [USER-2] +P00 WARN: backup user for pg_data was not mapped to a name, set to [USER-2] P00 DEBUG: Storage::Local->remove(): bIgnoreMissing = , bRecurse = , xstryPathFileExp = [TEST_PATH]/db-master/db/base/global/pg_control P00 DEBUG: Storage::Local->remove=>: bRemoved = true P00 DEBUG: Restore->clean(): oManifest = [object] @@ -1111,10 +1113,10 @@ P00 DETAIL: remove file [TEST_PATH]/db-master/db/base/base/pgsql_tmp/pgsql_tmp.1 P00 DEBUG: Storage::Local->remove(): bIgnoreMissing = , bRecurse = , xstryPathFileExp = [TEST_PATH]/db-master/db/base/base/pgsql_tmp/pgsql_tmp.1 P00 DEBUG: Storage::Local->remove=>: bRemoved = true P00 DETAIL: remove path [TEST_PATH]/db-master/db/base/base/pgsql_tmp -P00 DETAIL: set ownership [USER-1]:[GROUP-1] on [TEST_PATH]/db-master/db/base/base/16384/PG_VERSION -P00 DEBUG: Storage::Local->owner(): strGroup = [GROUP-1], strPathFileExp = [TEST_PATH]/db-master/db/base/base/16384/PG_VERSION, strUser = [USER-1] -P00 DETAIL: set ownership [USER-1]:[GROUP-1] on [TEST_PATH]/db-master/db/base/base/1/PG_VERSION -P00 DEBUG: Storage::Local->owner(): strGroup = [GROUP-1], strPathFileExp = [TEST_PATH]/db-master/db/base/base/1/PG_VERSION, strUser = [USER-1] +P00 DETAIL: set ownership [USER-1]:[GROUP-2] on [TEST_PATH]/db-master/db/base/base/16384/PG_VERSION +P00 DEBUG: Storage::Local->owner(): strGroup = [GROUP-2], strPathFileExp = [TEST_PATH]/db-master/db/base/base/16384/PG_VERSION, strUser = [USER-1] +P00 DETAIL: set ownership [USER-2]:[GROUP-1] on [TEST_PATH]/db-master/db/base/base/1/PG_VERSION +P00 DEBUG: Storage::Local->owner(): strGroup = [GROUP-1], strPathFileExp = [TEST_PATH]/db-master/db/base/base/1/PG_VERSION, strUser = [USER-2] P00 DETAIL: set mode 0660 on [TEST_PATH]/db-master/db/base/base/1/PG_VERSION P00 DETAIL: set mode 0700 on [TEST_PATH]/db-master/db/base/base P00 DETAIL: remove file [TEST_PATH]/db-master/db/base/backup_label.old @@ -1180,8 +1182,8 @@ P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/postgresql.conf, 21, [MODIFICATION-TIME-2], 6721d92c9fcdf4248acff1f9a1377127d9064807, 0, 0, pg_data/postgresql.conf, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/postgresql.conf, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/pg_stat/global.stat, 5, [MODIFICATION-TIME-2], e350d5ce0153f3e22d5db21cf2a4eff00f3ee877, 0, 0, pg_data/pg_stat/global.stat, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/pg_stat/global.stat, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/32768/PG_VERSION, 3, [MODIFICATION-TIME-1], 184473f470864e067ee3a22e64b47b0a1c356f29, 0, 0, pg_data/base/32768/PG_VERSION, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/32768/PG_VERSION, strOp = restoreFile, strQueue = pg_data -P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/16384/PG_VERSION, 3, [MODIFICATION-TIME-1], 184473f470864e067ee3a22e64b47b0a1c356f29, 0, 0, pg_data/base/16384/PG_VERSION, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/16384/PG_VERSION, strOp = restoreFile, strQueue = pg_data -P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/1/PG_VERSION, 3, [MODIFICATION-TIME-1], 184473f470864e067ee3a22e64b47b0a1c356f29, 0, 0, pg_data/base/1/PG_VERSION, [undef], 0660, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/1/PG_VERSION, strOp = restoreFile, strQueue = pg_data +P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/16384/PG_VERSION, 3, [MODIFICATION-TIME-1], 184473f470864e067ee3a22e64b47b0a1c356f29, 0, 0, pg_data/base/16384/PG_VERSION, [undef], 0600, [USER-1], root, [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/16384/PG_VERSION, strOp = restoreFile, strQueue = pg_data +P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/base/1/PG_VERSION, 3, [MODIFICATION-TIME-1], 184473f470864e067ee3a22e64b47b0a1c356f29, 0, 0, pg_data/base/1/PG_VERSION, [undef], 0660, root, [USER-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/base/1/PG_VERSION, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->queueJob(): iHostConfigIdx = 1, rParam = ([TEST_PATH]/db-master/db/base/PG_VERSION, 3, [MODIFICATION-TIME-1], 184473f470864e067ee3a22e64b47b0a1c356f29, 0, 0, pg_data/PG_VERSION, [undef], 0600, [USER-1], [GROUP-1], [MODIFICATION-TIME-3], 1, [BACKUP-FULL-2], 0), rParamSecure = [undef], strKey = pg_data/PG_VERSION, strOp = restoreFile, strQueue = pg_data P00 DEBUG: Protocol::Local::Process->hostConnect: start local process: iHostConfigIdx = 1, iHostIdx = 0, iHostProcessIdx = 0, iProcessId = 1, strHostType = backup P00 DEBUG: Protocol::Local::Master->new(): iProcessIdx = 1, strCommand = [BACKREST-BIN] --command=restore --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --host-id=1 --lock-path=[TEST_PATH]/db-master/lock --log-path=[TEST_PATH]/db-master/log --process=1 --protocol-timeout=60 --repo-path=[TEST_PATH]/db-master/repo --stanza=db --type=backup local @@ -1263,6 +1265,42 @@ P00 DEBUG: Common::Exit::exitSafe=>: iExitCode = 0 ---------------------------------------------------------------- restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --stanza=db archive-get %f "%p"' +restore delta, backup '[BACKUP-FULL-2]' - fix permissions (db-master host) +> [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --delta --set=[BACKUP-FULL-2] --link-all --log-level-console=detail --stanza=db restore +------------------------------------------------------------------------------------------------------------------------------------ +P00 INFO: restore command begin [BACKREST-VERSION]: --no-compress --compress-level=3 --config=[TEST_PATH]/db-master/pgbackrest.conf --db1-path=[TEST_PATH]/db-master/db/base --delta --link-all --lock-path=[TEST_PATH]/db-master/lock --log-level-console=detail --log-level-file=trace --log-level-stderr=off --log-path=[TEST_PATH]/db-master/log --protocol-timeout=60 --repo-path=[TEST_PATH]/db-master/repo --set=[BACKUP-FULL-2] --stanza=db +P00 INFO: restore backup set [BACKUP-FULL-2] +P00 WARN: backup group for pg_data/base/16384/PG_VERSION was not mapped to a name, set to [GROUP-1] +P00 WARN: backup user for pg_data/base/1/PG_VERSION was not mapped to a name, set to [USER-1] +P00 DETAIL: check [TEST_PATH]/db-master/db/base exists +P00 DETAIL: check [TEST_PATH]/db-master/db/pg_stat exists +P00 DETAIL: check [TEST_PATH]/db-master/db/pg_config exists +P00 INFO: remove invalid files/paths/links from [TEST_PATH]/db-master/db/pg_config +P00 INFO: remove invalid files/paths/links from [TEST_PATH]/db-master/db/pg_stat +P00 INFO: remove invalid files/paths/links from [TEST_PATH]/db-master/db/base +P00 DETAIL: preserve file [TEST_PATH]/db-master/db/base/recovery.conf +P00 DETAIL: set ownership [USER-1]:[GROUP-1] on [TEST_PATH]/db-master/db/base/base/16384/PG_VERSION +P00 DETAIL: set ownership [USER-1]:[GROUP-1] on [TEST_PATH]/db-master/db/base/base/1/PG_VERSION +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33001 - exists and matches backup (64KB, 39%) checksum 6bf316f11d28c28914ea9be92c00de9bea6d9a6b +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000.32767 - exists and matches backup (32KB, 59%) checksum 21e2c7c1a326682c07053b7d6a5a40dbd49c2ec5 +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/33000 - exists and matches backup (32KB, 79%) checksum 4a383e4fb8b5cd2a4e8fab91ef63dce48e532a2f +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/16384/17000 - exists and matches backup (16KB, 89%) checksum e0101dd8ffb910c9c202ca35b5f828bcb9697bed +P01 INFO: restore file [TEST_PATH]/db-master/db/base/global/pg_control.pgbackrest.tmp (8KB, 94%) checksum b4a3adade1e81ebfc7e9a27bca0887a347d81522 +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/1/12000 - exists and matches backup (8KB, 99%) checksum 22c98d248ff548311eda88559e4a8405ed77c003 +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/postgresql.conf - exists and matches backup (21B, 99%) checksum 6721d92c9fcdf4248acff1f9a1377127d9064807 +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/pg_stat/global.stat - exists and matches backup (5B, 99%) checksum e350d5ce0153f3e22d5db21cf2a4eff00f3ee877 +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/32768/PG_VERSION - exists and matches backup (3B, 99%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29 +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/16384/PG_VERSION - exists and matches backup (3B, 99%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29 +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/base/1/PG_VERSION - exists and matches backup (3B, 99%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29 +P01 DETAIL: restore file [TEST_PATH]/db-master/db/base/PG_VERSION - exists and matches backup (3B, 100%) checksum 184473f470864e067ee3a22e64b47b0a1c356f29 +P00 INFO: write [TEST_PATH]/db-master/db/base/recovery.conf +P00 INFO: restore global/pg_control (performed last to ensure aborted restores cannot be started) +P00 INFO: restore command end: completed successfully + ++ supplemental file: [TEST_PATH]/db-master/db/base/recovery.conf +---------------------------------------------------------------- +restore_command = '[BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --log-level-console=detail --stanza=db archive-get %f "%p"' + restore delta, backup '[BACKUP-FULL-2]' - fix broken symlink (db-master host) > [CONTAINER-EXEC] db-master [BACKREST-BIN] --config=[TEST_PATH]/db-master/pgbackrest.conf --delta --set=[BACKUP-FULL-2] --link-all --log-level-console=detail --log-level-console=detail --stanza=db restore ------------------------------------------------------------------------------------------------------------------------------------ @@ -1854,7 +1892,7 @@ group="[GROUP-1]" user="[USER-1]" [target:path] -pg_data={} +pg_data={"mode":"0777"} pg_data/base={} pg_data/base/1={} pg_data/base/16384={} @@ -1870,7 +1908,7 @@ pg_data/pg_stat={} pg_data/pg_stat_tmp={} pg_data/pg_subtrans={} pg_data/pg_tblspc={} -pg_tblspc={} +pg_tblspc={"mode":"0777"} pg_tblspc/1={} pg_tblspc/1/[TS_PATH-1]={} pg_tblspc/1/[TS_PATH-1]/16384={} @@ -2207,7 +2245,7 @@ group="[GROUP-1]" user="[USER-1]" [target:path] -pg_data={} +pg_data={"mode":"0777"} pg_data/base={} pg_data/base/1={} pg_data/base/16384={} @@ -2223,7 +2261,7 @@ pg_data/pg_stat={} pg_data/pg_stat_tmp={} pg_data/pg_subtrans={} pg_data/pg_tblspc={} -pg_tblspc={} +pg_tblspc={"mode":"0777"} pg_tblspc/1={} pg_tblspc/1/[TS_PATH-1]={} pg_tblspc/1/[TS_PATH-1]/16384={} @@ -2372,7 +2410,7 @@ group="[GROUP-1]" user="[USER-1]" [target:path] -pg_data={} +pg_data={"mode":"0777"} pg_data/base={} pg_data/base/1={} pg_data/base/16384={} @@ -2388,7 +2426,7 @@ pg_data/pg_stat={} pg_data/pg_stat_tmp={} pg_data/pg_subtrans={} pg_data/pg_tblspc={} -pg_tblspc={} +pg_tblspc={"mode":"0777"} pg_tblspc/1={} pg_tblspc/1/[TS_PATH-1]={} pg_tblspc/1/[TS_PATH-1]/16384={} @@ -2535,7 +2573,7 @@ group="[GROUP-1]" user="[USER-1]" [target:path] -pg_data={} +pg_data={"mode":"0777"} pg_data/base={} pg_data/base/1={} pg_data/base/16384={} @@ -2551,7 +2589,7 @@ pg_data/pg_stat={} pg_data/pg_stat_tmp={} pg_data/pg_subtrans={} pg_data/pg_tblspc={} -pg_tblspc={} +pg_tblspc={"mode":"0777"} pg_tblspc/1={} pg_tblspc/1/[TS_PATH-1]={} pg_tblspc/1/[TS_PATH-1]/16384={} diff --git a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm index e16dc0bbc..947584699 100644 --- a/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm +++ b/test/lib/pgBackRestTest/Module/Mock/MockAllTest.pm @@ -450,6 +450,16 @@ sub run forceStorageRemove(storageRepo(), $strResumePath, {bRecurse => true}); forceStorageMove(storageRepo(), 'backup/' . $self->stanza() . "/${strFullBackup}", $strResumePath); + # Set ownership on base directory to bogus values + if (!$bRemote) + { + executeTest('sudo chown 7777:7777 ' . $oHostDbMaster->dbBasePath()); + executeTest('sudo chmod 777 ' . $oHostDbMaster->dbBasePath()); + $oManifest{&MANIFEST_SECTION_TARGET_PATH}{&MANIFEST_TARGET_PGDATA}{&MANIFEST_SUBKEY_USER} = INI_FALSE; + $oManifest{&MANIFEST_SECTION_TARGET_PATH}{&MANIFEST_TARGET_PGDATA}{&MANIFEST_SUBKEY_GROUP} = INI_FALSE; + $oManifest{&MANIFEST_SECTION_TARGET_PATH}{&MANIFEST_TARGET_PGDATA}{&MANIFEST_SUBKEY_MODE} = '0777'; + } + $oHostBackup->manifestMunge( basename($strResumePath), {&MANIFEST_SECTION_TARGET_FILE => @@ -512,13 +522,13 @@ sub run # Remove a file $oHostDbMaster->dbFileRemove(\%oManifest, MANIFEST_TARGET_PGDATA, 'base/16384/17000'); - # Restore will reset invalid user and group so do the same in the manifest + # Restore will set invalid user and group to root since the base path user/group are also invalid if (!$bRemote) { - delete($oManifest{&MANIFEST_SECTION_TARGET_FILE}{MANIFEST_TARGET_PGDATA . '/base/1/' . DB_FILE_PGVERSION} - {&MANIFEST_SUBKEY_USER}); - delete($oManifest{&MANIFEST_SECTION_TARGET_FILE}{MANIFEST_TARGET_PGDATA . '/base/16384/' . DB_FILE_PGVERSION} - {&MANIFEST_SUBKEY_GROUP}); + $oManifest{&MANIFEST_SECTION_TARGET_FILE}{MANIFEST_TARGET_PGDATA . '/base/1/' . DB_FILE_PGVERSION} + {&MANIFEST_SUBKEY_USER} = 'root'; + $oManifest{&MANIFEST_SECTION_TARGET_FILE}{MANIFEST_TARGET_PGDATA . '/base/16384/' . DB_FILE_PGVERSION} + {&MANIFEST_SUBKEY_GROUP} = 'root'; } $oHostDbMaster->restore( @@ -526,9 +536,34 @@ sub run 'add and delete files', undef, ' --link-all' . ($bRemote ? ' --cmd-ssh=/usr/bin/ssh' : ''), undef, !$bRemote ? 'root' : undef); - # Fix permissions on the restore log & remove lock files + # Run again to fix permissions if (!$bRemote) { + # Reset the base path user and group for the next restore so files will be reset to the base path user/group + executeTest('sudo chown ' . TEST_USER . ':' . TEST_GROUP . ' ' . $oHostDbMaster->dbBasePath()); + + $oHostBackup->manifestMunge( + $strFullBackup, + {&MANIFEST_SECTION_TARGET_PATH => + {&MANIFEST_TARGET_PGDATA => + {&MANIFEST_SUBKEY_USER => undef, &MANIFEST_SUBKEY_GROUP => undef, &MANIFEST_SUBKEY_MODE => undef}}}, + false); + + delete($oManifest{&MANIFEST_SECTION_TARGET_PATH}{&MANIFEST_TARGET_PGDATA}{&MANIFEST_SUBKEY_USER}); + delete($oManifest{&MANIFEST_SECTION_TARGET_PATH}{&MANIFEST_TARGET_PGDATA}{&MANIFEST_SUBKEY_GROUP}); + + delete( + $oManifest{&MANIFEST_SECTION_TARGET_FILE}{MANIFEST_TARGET_PGDATA . '/base/1/' . DB_FILE_PGVERSION} + {&MANIFEST_SUBKEY_USER}); + delete( + $oManifest{&MANIFEST_SECTION_TARGET_FILE}{MANIFEST_TARGET_PGDATA . '/base/16384/' . DB_FILE_PGVERSION} + {&MANIFEST_SUBKEY_GROUP}); + + $oHostDbMaster->restore( + $strFullBackup, \%oManifest, undef, $bDelta, $bForce, undef, undef, undef, undef, undef, undef, + 'fix permissions', undef, ' --link-all --log-level-console=detail', undef, 'root'); + + # Fix and remove files that are now owned by root executeTest('sudo chown -R ' . TEST_USER . ':' . TEST_GROUP . ' ' . $oHostBackup->logPath()); executeTest('sudo rm -rf ' . $oHostDbMaster->lockPath() . '/*'); } @@ -878,6 +913,12 @@ sub run $oRemapHash{&MANIFEST_TARGET_PGTBLSPC . '/1'} = $oHostDbMaster->tablespacePath(1, 2); $oRemapHash{&MANIFEST_TARGET_PGTBLSPC . '/2'} = $oHostDbMaster->tablespacePath(2, 2); + # At this point the $PG_DATA permissions have been reset to 0600 + if (!$bRemote) + { + delete($oManifest{&MANIFEST_SECTION_TARGET_PATH}{&MANIFEST_TARGET_PGDATA}{&MANIFEST_SUBKEY_MODE}); + } + $oHostDbMaster->restore( $strBackup, \%oManifest, \%oRemapHash, $bDelta, $bForce, undef, undef, undef, undef, undef, undef, 'remap all paths', undef, $strLogReduced);