Re: merge file_exists_in_directory and _fileExistsInDirectory functions and move into common file dumputils.c

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: merge file_exists_in_directory and _fileExistsInDirectory functions and move into common file dumputils.c
Date: 2025-04-11 09:38:12
Message-ID: 202504110938.4kx73ylnv6p4@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Apr-11, Michael Paquier wrote:

> Perhaps we should just use a more centralized place, like file_utils.c
> so as all frontends could benefit of it?

I'm not sure about that. This code looks to be making too many
assumptions that aren't acceptable for a general routine, such as
complaining only that the directory name is long without the possibility
that the culprit is the file name. It's more or less okay in current
uses because they're all using harcoded short names, but that would not
hold in general. At the same time, isn't every call of this routine a
potential TOCTTOU bug? Again it's probably fine for the current code,
but I wouldn't be too sure about making this generally available as-is.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"Oh, great altar of passive entertainment, bestow upon me thy discordant images
at such speed as to render linear thought impossible" (Calvin a la TV)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-04-11 10:23:53 Re: Prevent an error on attaching/creating a DSM/DSA from an interrupt handler.
Previous Message Antonin Houska 2025-04-11 09:28:02 Re: why there is not VACUUM FULL CONCURRENTLY?