From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | knizhnik(at)garret(dot)ru |
Subject: | BUG #15822: Incorrect handling of pending deletes |
Date: | 2019-05-28 11:00:39 |
Message-ID: | 15822-48a04833395f772c@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15822
Logged by: Konstantin Knizhnik
Email address: knizhnik(at)garret(dot)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-to-open-a-delete-pended-f
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;
}
From | Date | Subject | |
---|---|---|---|
Next Message | Nick Anderson | 2019-05-28 13:24:34 | RE: Re: Re: RE: Re: Re: BUG #15769: The database cluster intialisation failed. |
Previous Message | Michael Paquier | 2019-05-28 10:58:02 | Re: BUG #15789: libpq compilation with OpenSSL 1.1.1b fails on Windows with Visual Studio 2017 |