RE: stat() on Windows might cause error if target file is largerthan 4GB
От
Higuchi, Daisuke
Тема
RE: stat() on Windows might cause error if target file is largerthan 4GB
Дата
Msg-id
1803D792815FC24D871C00D17AE95905CF6092@g01jpexmbkw24
Ответ на
Re: stat() on Windows might cause error if target file is largerthan 4GB (Michael Paquier)
Список
Дерево обсуждения
stat() on Windows might cause error if target file is larger than4GB "Higuchi, Daisuke" <higuchi.daisuke@jp.fujitsu.com>
Re: stat() on Windows might cause error if target file is largerthan 4GB Michael Paquier <michael@paquier.xyz>
Re: stat() on Windows might cause error if target file is largerthan 4GB Michael Paquier <michael@paquier.xyz>
RE: stat() on Windows might cause error if target file is largerthan 4GB "Higuchi, Daisuke" <higuchi.daisuke@jp.fujitsu.com>
Re: stat() on Windows might cause error if target file is largerthan 4GB Michael Paquier <michael@paquier.xyz>
Re: stat() on Windows might cause error if target file is larger than 4GB Tom Lane <tgl@sss.pgh.pa.us>
Re: stat() on Windows might cause error if target file is largerthan 4GB Michael Paquier <michael@paquier.xyz>
Re: stat() on Windows might cause error if target file is largerthan 4GB Michael Paquier <michael@paquier.xyz>
Re: stat() on Windows might cause error if target file is larger than 4GB Tom Lane <tgl@sss.pgh.pa.us>
Re: stat() on Windows might cause error if target file is largerthan 4GB Michael Paquier <michael@paquier.xyz>
Re: stat() on Windows might cause error if target file is larger than 4GB Tom Lane <tgl@sss.pgh.pa.us>
Re: stat() on Windows might cause error if target file is largerthan 4GB Alvaro Herrera <alvherre@2ndquadrant.com>
Re: stat() on Windows might cause error if target file is larger than 4GB Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
Re: stat() on Windows might cause error if target file is larger than 4GB Robert Haas <robertmhaas@gmail.com>
Re: stat() on Windows might cause error if target file is largerthan 4GB Michael Paquier <michael@paquier.xyz>
Re: stat() on Windows might cause error if target file is larger than 4GB Robert Haas <robertmhaas@gmail.com>
Re: stat() on Windows might cause error if target file is larger than 4GB Tom Lane <tgl@sss.pgh.pa.us>
Michael-san,
From: Michael Paquier [mailto:michael@paquier.xyz]
>Does something like the patch attached help?
>This makes sure that st_size is set correctly for files with a size larger than 4GB.
Thank you for creating patch, but this does not solve current problem.
Of cause setting wrong size to st_size is problem,
I think the cause of this problem is stat()'s return value (=-1).
In pgwin32_safestat(), if stat() try to deal with files with a size larger than 4GB,
the return value is -1. So, pgwin32_safestat() exits before calculating buf->st_size.
----
pgwin32_safestat(const char *path, struct stat *buf)
{
int r;
WIN32_FILE_ATTRIBUTE_DATA attr;
r = stat(path, buf);
if (r < 0)
{
...
return r;
}
...
buf->st_size = attr.nFileSizeLow;
return 0;
}
----
So, attached patch help me and strange message disappeared,
but I ignore the impact of this for others now.
Regards,
Daisuke, Higuchi
В списке pgsql-hackers по дате отправления