1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-11 00:50:20 +02:00

Fix archive-push/archive-get when PGDATA is symlinked.

Commit 7168e074 tried to use cwd() as PGDATA but this would disagree with the path configured in pgBackRest if PGDATA was symlinked.

If cwd() does not match the pgBackRest path then chdir() to the path and make sure the next cwd() matches the result from the first call.
This commit is contained in:
David Steele
2019-12-11 14:36:39 -05:00
parent 8c840c28a6
commit 0194a98671
8 changed files with 100 additions and 15 deletions

View File

@ -588,6 +588,8 @@ testRun(void)
strLstAdd(argList, strNewFmt("--pg1-path=%s/db", testPath()));
harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList));
THROW_ON_SYS_ERROR(chdir(strPtr(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
HARNESS_FORK_BEGIN()
{
HARNESS_FORK_CHILD_BEGIN(0, false)
@ -623,8 +625,6 @@ testRun(void)
// Write out a WAL segment for success
// -------------------------------------------------------------------------------------------------------------------------
THROW_ON_SYS_ERROR(chdir(strPtr(cfgOptionStr(cfgOptPgPath))) != 0, PathMissingError, "unable to chdir()");
storagePutP(
storageNewWriteP(storageSpoolWrite(), strNewFmt(STORAGE_SPOOL_ARCHIVE_IN "/%s", strPtr(walSegment))),
BUFSTRDEF("SHOULD-BE-A-REAL-WAL-FILE"));