Re: BUG #17288: PSQL bug with COPY command (Windows)
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Dmitry Koval <d.koval@postgrespro.ru>, Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2021-11-29T06:51:39Z
Lists: pgsql-bugs
Attachments
- mingw-fstat-fix.patch (text/x-diff) patch
On Sun, Nov 28, 2021 at 11:01:22PM -0600, Justin Pryzby wrote: > Do you know this causes a new warning ? No, I did not know that. > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=jacana&dt=2021-11-29%2004%3A00%3A29 > > Nov 28 23:06:41 c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.build/../pgsql/src/port/win32stat.c:309:3: warning: implicit declaration of function 'GetFinalPathNameByHandleA'; did you mean 'GetFullPathNameA'? [-Wimplicit-function-declaration] > ... Hmm. Looking at MinGW, mingw-w64-headers/include/fileapi.h includes GetFinalPathNameByHandleA() as long as _WIN32_WINNT >= 0x0600, so this stuff is not going to work when we are under an older _WIN32_WINNT as it seems to be the case here. I have missed that. We know that GetFileInformationByHandle() would be able to work in the scope of win32stat.c as it is supported down to Windows XP so we would be covered, so switching to that instead of GetFinalPathNameByHandleA() would take care of the problem. Better to call that only for a standard stream, only for the emulation of fstat(), in the spirit of the original fix. -- Michael
Commits
-
Fix compatibility thinko for fstat() on standard streams in win32stat.c
- 5550a9c38519 14.2 landed
- 58651d8dd6a5 15.0 landed
-
Fix fstat() emulation on Windows with standard streams
- d2198b4593cc 14.2 landed
- 10260c794b21 15.0 landed