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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Implement find_my_exec()'s path normalization using realpath(3).
Date: 2023-03-23 22:17:56
Message-ID: E1pfTFs-0053Gf-Cz@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2023-03-23 23:48:34 pgsql: Rename fields in pgstat structures for functions and relations
Previous Message Daniel Gustafsson 2023-03-23 20:48:27 pgsql: doc: fix another case of missing productname markup