From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: knizhnik@garret.ru
Subject: BUG #15822: Incorrect handling of pending deletes
Date: Tue, 28 May 2019 11:00:39 +0000
Message-ID: <15822-48a04833395f772c@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15822
Logged by: Konstantin Knizhnik
Email address: knizhnik@garret.ru
PostgreSQL version: 11.3
Operating system: Windows
Description:
Function pgwin32_safestat oncorrectly handles access to the fiel which
delete is pending because it is opened by some backends:
This functions assumes that stat() will return error in this case and
GetLastError - ERROR_DELETE_PENDING.
But actually ERROR_DELETE_PENDING is internal error code which is never
returned by Win32:
https://stackoverflow.com/questions/6680491/why-does-windows-return-error-access-denied-when-i-try-t...
I have tested that stat() returns 0 (success) for such file and subsequent
call ofGetFileAttributesEx is failed with ERROR_ACCESS_DENIED error.
I think that this function should be rewritten to:
int
pgwin32_safestat(const char *path, struct stat *buf)
{
int r;
WIN32_FILE_ATTRIBUTE_DATA attr;
r = stat(path, buf);
if (r < 0)
return r;
if (!GetFileAttributesEx(path, GetFileExInfoStandard, &attr))
{
errno = ENOENT;
return -1;
}
/*
* XXX no support for large files here, but we don't do that in general
on
* Win32 yet.
*/
buf->st_size = attr.nFileSizeLow;
return 0;
}
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-bugs@postgresql.org
Cc: noreply@postgresql.org, knizhnik@garret.ru
Subject: Re: BUG #15822: Incorrect handling of pending deletes
In-Reply-To: <15822-48a04833395f772c@postgresql.org>
References: <15822-48a04833395f772c@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