pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix compatibility thinko for fstat() on standard streams in win3
Date: Tue, 30 Nov 2021 00:56:22 +0000
Message-ID: <E1mrrRW-0001Qf-Rr@gemulon.postgresql.org> (raw)

Fix compatibility thinko for fstat() on standard streams in win32stat.c

GetFinalPathNameByHandleA() cannot be used in compilation environments
where _WIN32_WINNT < 0x0600, meaning at least Windows XP used by some
buildfarm members under MinGW that Postgres still needs to support.
This was reported as a compilation warning by the buildfarm, but this is
actually worse than the report as the code would have not worked.

Instead, this switches to GetFileInformationByHandle() that is able to
fail for standard streams and succeed for redirected ones, which is what
we are looking for herein the code emulating fstat().  We also know that
it is able to work in all the environments still supported, thanks to
the existing logic of win32stat.c.

Issue introduced by 10260c7, so backpatch down to 14.

Reported-by: Justin Pryzby, via buildfarm member jacana
Author: Michael Paquier
Reviewed-by: Juan José Santamaría Flecha
Discussion: https://postgr.es/m/20211129050122.GK17618@telsasoft.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5550a9c385198ac51d2f3b17be2f6ff9f886d76d

Modified Files
--------------
src/port/win32stat.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1mrrRW-0001Qf-Rr@gemulon.postgresql.org>
Permalink:  ../E1mrrRW-0001Qf-Rr@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mrrRW-0001Qf-Rr@gemulon.postgresql.org

 · 

reply

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-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Fix compatibility thinko for fstat() on standard streams in win3
  In-Reply-To: <E1mrrRW-0001Qf-Rr@gemulon.postgresql.org>
  References: <E1mrrRW-0001Qf-Rr@gemulon.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