pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Implement find_my_exec()'s path normalization using realpath(3).
Date: Thu, 23 Mar 2023 22:17:56 +0000
Message-ID: <E1pfTFs-0053Gf-Cz@gemulon.postgresql.org> (raw)

Implement find_my_exec()'s path normalization using realpath(3).

Replace the symlink-chasing logic in find_my_exec with realpath(3),
which has been required by POSIX since SUSv2.  (Windows lacks
realpath(), but there we can use _fullpath() which is functionally
equivalent.)  The main benefit of this is that -- on all modern
platforms at least -- realpath() avoids the chdir() shenanigans
we used to perform while interpreting symlinks.  That had various
corner-case failure modes so it's good to get rid of it.

There is still ongoing discussion about whether we could skip the
replacement of symlinks in some cases, but that's really matter
for a separate patch.  Meanwhile I want to push this before we get
too close to feature freeze, so that we can find out if there are
showstopper portability issues.

Discussion: https://postgr.es/m/797232.1662075573@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/11a0a8b529caeab101206ec4a33af95bb4445746

Modified Files
--------------
src/common/exec.c | 206 ++++++++++++++++++++++++------------------------------
1 file changed, 91 insertions(+), 115 deletions(-)



Message-ID: <E1pfTFs-0053Gf-Cz@gemulon.postgresql.org>
Permalink:  ../E1pfTFs-0053Gf-Cz@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pfTFs-0053Gf-Cz@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Implement find_my_exec()'s path normalization using realpath(3).
  In-Reply-To: <E1pfTFs-0053Gf-Cz@gemulon.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