Re: BUG #17288: PSQL bug with COPY command (Windows)

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>, Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17288: PSQL bug with COPY command (Windows)
Date: 2021-11-29 06:51:39
Message-ID: YaR4e1Pj6wAt+fPT@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

Attachment Content-Type Size
mingw-fstat-fix.patch text/x-diff 736 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Juan José Santamaría Flecha 2021-11-29 07:53:28 Re: BUG #17288: PSQL bug with COPY command (Windows)
Previous Message Justin Pryzby 2021-11-29 05:01:22 Re: BUG #17288: PSQL bug with COPY command (Windows)