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

Поиск
Список
Период
Сортировка
От Isaac Morland
Тема Re: Can we avoid chdir'ing in resolve_symlinks() ?
Дата
Msg-id CAMsGm5cn+8Pdf8igAYAT601LmhsaT2ocASzaaM+1m-ro5zgwZg@mail.gmail.com
обсуждение исходный текст
Ответ на Can we avoid chdir'ing in resolve_symlinks() ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Can we avoid chdir'ing in resolve_symlinks() ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Thu, 1 Sept 2022 at 19:39, Tom Lane <tgl@sss.pgh.pa.us> wrote:

This code was mine originally (336969e49), but I sure don't
remember why I wrote it like that.  I know we didn't have a
robust version of canonicalize_path() then, and that may have
been the main issue, but that offhand comment about mount
points bothers me.  But I can't reconstruct precisely what
I was worried about there.  The only contemporaneous discussion
thread I can find is [2], which doesn't go into coding details.

Does this happen in a context where we need to worried about the directory structure changing under us, either accidentally or maliciously?

I'm wondering because I understand cd'ing through the structure can avoid some of the related problems and might be the reason for doing it that way originally. My impression is that the modern equivalent would be to use openat() with O_PATH to step through the hierarchy. But then I'm not clear on how to get back to the absolute path, given a file descriptor for the final directory.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: windows resource files, bugs and what do we actually want
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Can we avoid chdir'ing in resolve_symlinks() ?