Re: Can we avoid chdir'ing in resolve_symlinks() ?

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Can we avoid chdir'ing in resolve_symlinks() ?
Date: 2022-09-12 22:52:28
Message-ID: c3f9468b-1cb6-2dc2-724b-203c184be747@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2022-09-12 Mo 16:07, Tom Lane wrote:
> Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> writes:
>> On 12.09.22 17:33, Tom Lane wrote:
>>> Are you proposing we give up the support for relocatable installations?
>>> I'm not here to defend that feature, but I bet somebody will. (And
>>> doesn't "make check" depend on it?)
>> I'm complaining specifically about the resolving of symlinks. Why does
>> $ /usr/local/opt/postgresql(at)13/bin/pg_config --bindir
>> print
>> /usr/local/Cellar/postgresql(at)13/13.8/bin
>> when it clearly should print
>> /usr/local/opt/postgresql(at)13/bin
> I'm not sure about your setup there, but if you mean that
> /usr/local/opt/postgresql(at)13/bin is a symlink reading more or less
> "./13.8/bin", I doubt that failing to canonicalize that is a good idea.
> The point of finding the bindir is mainly to be able to navigate to its
> sibling directories such as lib/, etc/, share/. There's no certainty
> that a symlink leading to the bin directory will have sibling symlinks
> to those other directories.
>
>

I think the discussion here is a bit tangential to the original topic.

The point you make is reasonable, but it seems a bit more likely that in
the case Peter cites the symlink is one level higher in the tree, in
which case there's probably little value in resolving the symlink. Maybe
we could compromise and check if a path exists and only resolve symlinks
if it does not?

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2022-09-12 23:06:33 Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)
Previous Message Andres Freund 2022-09-12 21:53:17 Re: Error "initial slot snapshot too large" in create replication slot