Re: Expand the use of check_canonical_path() for more GUCs - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Expand the use of check_canonical_path() for more GUCs
Date
Msg-id 1142571.1591209950@sss.pgh.pa.us
Whole thread Raw
In response to Re: Expand the use of check_canonical_path() for more GUCs  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Expand the use of check_canonical_path() for more GUCs  (Michael Paquier <michael@paquier.xyz>)
Re: Expand the use of check_canonical_path() for more GUCs  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Jun 2, 2020 at 5:04 AM Peter Eisentraut
> <peter.eisentraut@2ndquadrant.com> wrote:
>> The archeology reveals that these calls where originally added to
>> canonicalize the data_directory and config_file settings (7b0f060d54),
>> but that was then moved out of guc.c to be done early during postmaster
>> startup (337ffcddba).  The remaining calls of check_canonical_path() in
>> guc.c appear to be leftovers from a previous regime.

> Thanks for looking into it. Sounds like it can just be ripped out,
> then, unless someone knows of a reason to do otherwise.

In the abstract, I agree with Peter's point that we shouldn't alter
user-given strings without need.  However, I think there's strong
reason for canonicalizing the data directory and config file locations.
We access those both before and after chdir'ing into the datadir, so
we'd better have absolute paths to them --- and at least for the
datadir, it's documented that you can initially give it as a path
relative to wherever you started the postmaster from.  If the other
files are only accessed after the chdir happens then we could likely
do without canonicalizing them.  But ... do we know which directory
the user (thought he) specified them with reference to?  Forced
canonicalization does have the advantage that it's clear to all
onlookers how we are interpreting the paths.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Parallel copy
Next
From: Andres Freund
Date:
Subject: Re: Parallel copy