pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: d.kovalenko@postgrespro.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18971: Server passes an invalid (indirect) path in PGDATA to the external program
Date: Sat, 28 Jun 2025 15:13:25 -0400
Message-ID: <2334360.1751138005@sss.pgh.pa.us> (raw)
In-Reply-To: <18971-53687392b125e4bf@postgresql.org>
References: <18971-53687392b125e4bf@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> 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.

I do not think this is a Postgres bug.  The PGDATA environment
variable is not canonical, it is just the default to be used if
you don't specify a -D switch on the postmaster/pg_ctl command line.
In fact, it might not be set at all.  (I see that pg_ctl does set
it, but pg_ctl is not the only way to start the postmaster.)
Therefore, relying on PGDATA in a restore_command script isn't safe.
You should be relying on the current working directory (PWD) instead.

			regards, tom lane





view thread (6+ messages)  latest in thread

Message-ID: <2334360.1751138005@sss.pgh.pa.us>
Permalink:  ../2334360.1751138005@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2334360.1751138005@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, d.kovalenko@postgrespro.ru, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18971: Server passes an invalid (indirect) path in PGDATA to the external program
  In-Reply-To: <2334360.1751138005@sss.pgh.pa.us>

* 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