pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Teach pg_ls_dir_files() to ignore ENOENT failures from stat().
Date: Tue, 31 Mar 2020 16:58:09 +0000
Message-ID: <E1jJKDJ-0002el-3J@gemulon.postgresql.org> (raw)

Teach pg_ls_dir_files() to ignore ENOENT failures from stat().

Buildfarm experience shows that this function can fail with ENOENT
if some other process unlinks a file between when we read the directory
entry and when we try to stat() it.  The problem is old but we had
not noticed it until 085b6b667 added regression test coverage.

To fix, just ignore ENOENT failures.  There is one other case that
this might hide: a symlink that points to nowhere.  That seems okay
though, at least better than erroring.

Back-patch to v10 where this function was added, since the regression
test cases were too.

Discussion: https://postgr.es/m/20200308173103.GC1357@telsasoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/82e801852274e46492b0e160624a850157c677e4

Modified Files
--------------
src/backend/utils/adt/genfile.c | 5 +++++
1 file changed, 5 insertions(+)



view thread (4+ messages)

Message-ID: <E1jJKDJ-0002el-3J@gemulon.postgresql.org>
Permalink:  ../E1jJKDJ-0002el-3J@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jJKDJ-0002el-3J@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Teach pg_ls_dir_files() to ignore ENOENT failures from stat().
  In-Reply-To: <E1jJKDJ-0002el-3J@gemulon.postgresql.org>
  References: <E1jJKDJ-0002el-3J@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox