From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Steele <david(at)pgmasters(dot)net>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Subject: | Re: pg11+: pg_ls_*dir LIMIT 1: temporary files .. not closed at end-of-transaction |
Date: | 2020-03-29 16:37:05 |
Message-ID: | 27064.1585499825@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
>> Maybe we should lstat() the file to determine if it's a dangling link; if
>> lstat() fails, then skip it. Currently, we use stat(), which shows metdata of
>> a link's *target*. Maybe we'd change that.
> Hm, good point that ENOENT could refer to a symlink's target. Still,
> I'm not sure it's worth going out of our way to disambiguate that,
> given that these directories aren't really supposed to contain symlinks.
> (And on the third hand, if they aren't supposed to, then maybe these
> functions needn't look through any symlinks? In which case just
> substituting lstat for stat would resolve the ambiguity.)
After looking at the callers of pg_ls_dir_files, and noticing that
it's already defined to ignore anything that's not a regular file,
I think switching to lstat makes sense.
I also grepped the other uses of ReadDir[Extended], and didn't see
any other ones that seemed desperately in need of changing.
So the attached seems like a sufficient fix.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
ignore-concurrent-removals-in-pg_ls_dir_files.patch | text/x-diff | 732 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-03-29 17:00:23 | Re: Can we get rid of GetLocaleInfoEx() yet? |
Previous Message | Tomas Vondra | 2020-03-29 15:31:05 | Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions |