Re: merge file_exists_in_directory and _fileExistsInDirectory functions and move into common file dumputils.c
Álvaro Herrera <alvherre@kurilemu.de>
From: Álvaro Herrera <alvherre@kurilemu.de>
To: Michael Paquier <michael@paquier.xyz>
Cc: Mahendra Singh Thalor <mahi6run@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Andrew Dunstan <andrew@dunslane.net>
Date: 2025-04-11T09:38:12Z
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)