pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitry Kovalenko <d.kovalenko@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
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 22:32:59 +0300
Message-ID: <ec6c6594-8b0f-487d-a1e9-9f9f456bf573@postgrespro.ru> (raw)
In-Reply-To: <2334360.1751138005@sss.pgh.pa.us>
References: <18971-53687392b125e4bf@postgresql.org>
	<2334360.1751138005@sss.pgh.pa.us>

Hello Tom,

> 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.
A test executes pg_ctl with the correct path to cluster and the correct CWD.

pg_ctl (and so on) executes an external program with inconsistent PGDATA 
and CWD.

This is clearly a problem on your side )

I wonder that it was not detected earlier.

For my point of view, if you can't provider a valid path in PGDATA, do 
not do it at all.

With Best Regards,

Dmitry Kovalenko






view thread (6+ messages)  latest in thread

Message-ID: <ec6c6594-8b0f-487d-a1e9-9f9f456bf573@postgrespro.ru>
Permalink:  ../ec6c6594-8b0f-487d-a1e9-9f9f456bf573@postgrespro.ru/
Also on:    postgresql.org/message-id/ec6c6594-8b0f-487d-a1e9-9f9f456bf573@postgrespro.ru

 · 

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

* 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