From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: d.kovalenko@postgrespro.ru
Subject: BUG #18971: Server passes an invalid (indirect) path in PGDATA to the external program
Date: Sat, 28 Jun 2025 07:17:54 +0000
Message-ID: <18971-53687392b125e4bf@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 18971
Logged by: Dmitry Kovalenko
Email address: d.kovalenko@postgrespro.ru
PostgreSQL version: 18beta1
Operating system: Ubuntu 2024.04
Description:
Hello,
PG version is 18beta1 (bbccf7ec)
OS is Ubunty 24.04
---------- SHORT DESCRIPTION
Server passes an invalid (indirect) path in PGDATA to the external program.
Server must provide to the external programs a right, absolute path in
PGDATA.
---------- FULL DESCRIPTION / STEPS
1) Our SPECIAL test starts PG with an indirect path to the database cluster
files:
CWD is:
"/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01"
COMMAND is:
pg_ctl start -D
"../../../../../../../../../../../..//home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/tests/tmp_dirs/ArchiveTest/test_archive_get_relative_path/restored/data"
-l
"../../../../../../../../../../../..//home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/tests/tmp_dirs/ArchiveTest/test_archive_get_relative_path/restored/logs/postgres.log"
postgresql.auto.conf of this cluster has the following lines:
------ [begin of postgresql.auto.conf]
archive_mode = 'on'
archive_command = 'exec
"/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/builddir/src/pg_probackup3"
archive-push -B
/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/tests/tmp_dirs/ArchiveTest/test_archive_get_relative_path/backup
--instance=node --compress-algorithm=zlib --log-level-console=trace
--no-sync --wal-file-path=%p --wal-file-name=%f'
recovery_target_timeline = 'current'
recovery_target_action = 'pause'
restore_command =
'"/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/builddir/src/pg_probackup3"
archive-get -B
"/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/tests/tmp_dirs/ArchiveTest/test_archive_get_relative_path/backup"
--instance "node" --wal-file-path=%p --wal-file-name=%f'
------ [/end of postgresql.auto.conf]
2) pc_ctl starts the postmaster with this PWD:
"/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01"
So, the path to the cluster files in "-D" is valid and is:
"/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/tests/tmp_dirs/ArchiveTest/test_archive_get_relative_path/restored/data"
3) During start Postgres runs the external program pg_probackup3 with the
following commandline (I got it with "ps -eo args | grep probackup"):
sh -c --
"/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/builddir/src/pg_probackup3"
archive-get -B
"/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/tests/tmp_dirs/ArchiveTest/test_archive_get_relative_path/backup"
--instance "node" --wal-file-path=pg_wal/RECOVERYXLOG
--wal-file-name=000000010000000000000002
This command runs the next process:
/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/builddir/src/pg_probackup3
archive-get -B
/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/tests/tmp_dirs/ArchiveTest/test_archive_get_relative_path/backup
--instance node --wal-file-path=pg_wal/RECOVERYXLOG
--wal-file-name=000000010000000000000002
4) pg_probackup3 process has the following environment variables:
PWD="/home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/tests/tmp_dirs/ArchiveTest/test_archive_get_relative_path/restored/data"
PGDATA="../../../../../../../../../../../../home/dima/MY/Work/CurrentTasks/2025/PBCKP-2289/_Iter003/001--Vanilla-master/Probackup3/work01/tests/tmp_dirs/ArchiveTest/test_archive_get_relative_path/restored/data"
---------- PROBLEM
PGDATA (4) is invalid for pg_probackup3. Because PWD of probackup (4) != PWD
of server (2).
When probackup is trying to use this PGDATA, it fails.
Server must provide to the external programs a right, absolute path in
PGDATA.
Thanks&Regards,
Dmitry Kovalenko,
Postgres Professional, Russia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, d.kovalenko@postgrespro.ru
Subject: Re: BUG #18971: Server passes an invalid (indirect) path in PGDATA to the external program
In-Reply-To: <18971-53687392b125e4bf@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox